My favorites | Sign in
Logo
          
New issue | Search
for
| Advanced search | Search tips
Issue 112: Error Predefined Constants Not available for PHP 5.x versions
2 people starred this issue and may be notified of changes. Back to list
Status:  Committed
Owner:  ----
Type-Defect
Priority-Medium
Milestone-FirePHP...re-0.3.2


Sign in to add a comment
 
Reported by laurent.laville, Jun 17, 2009
What is the expected output? 
If PHP 5.3 I supose it should be
E_USER_DEPRECATED: since php 5.3 only

But as I got only PHP 5.2.9
E_WARNING: Invalid error type specified

What do you see instead?
E_NOTICE: Use of undefined constant E_USER_DEPRECATED - assumed
'E_USER_DEPRECATED'


What version of the product are you using?
PHP 5.2.9-2 (windows) With FirePHP 0.3.1 (core and extension)


Please provide any additional information below.
A little script that demonstrate the problem

<?php
require_once 'FirePHPCore/FirePHP.class.php';
$firephp = FirePHP::getInstance(true);

$firephp->registerErrorHandler();
$firephp->registerExceptionHandler();

trigger_error('since php 5.3 only', E_USER_DEPRECATED);
?>

Reason is uses of Error Predefined constants available only for PHP 5.3
See also all other available since only PHP 5

Full list available there: 
http://fr2.php.net/manual/en/errorfunc.constants.php

Perharps you could used this kind of declaration at top of FirePHP.class.php

if (!defined('E_USER_DEPRECATED')) {
    define('E_USER_DEPRECATED', 16384);
}

Comment 1 by christ...@christophdorn.com, Jun 17, 2009
Committed r623.

Please see if this fixes it as intended.
Status: Committed
Labels: Milestone-FirePHPCore-0.3.2
Comment 2 by laurent.laville, Jun 17, 2009
Hello Christoph,

r623 is not a full fix. I only gave an example, but you should also fix for others
PHP5 constants: See on lines 699 to 702 of r623.

699          case E_STRICT: $severity = 'E_STRICT'; break;
700          case E_RECOVERABLE_ERROR: $severity = 'E_RECOVERABLE_ERROR'; break;
701          case E_DEPRECATED: $severity = 'E_DEPRECATED'; break;
702          case E_USER_DEPRECATED: $severity = 'E_USER_DEPRECATED'; break;

if (!defined('E_STRICT')) {
    define('E_STRICT', 2048);  // since PHP5
}
if (!defined('E_RECOVERABLE_ERROR')) {
    define('E_RECOVERABLE_ERROR', 4096);  // since PHP 5.2
}
if (!defined('E_DEPRECATED')) {
    define('E_DEPRECATED', 8192);  // since PHP 5.3
}
if (!defined('E_USER_DEPRECATED')) {
    define('E_USER_DEPRECATED', 16384);  // since PHP 5.3
}

Hope it will help
Laurent
Comment 3 by christ...@christophdorn.com, Jun 18, 2009
Thanks. See r624.
Sign in to add a comment

Hosted by Google Code