Export to GitHub

firephp - issue #112

Error Predefined Constants Not available for PHP 5.x versions


Posted on Jun 17, 2009 by Quick Hippo

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

Posted on Jun 17, 2009 by Happy Camel

Committed r623.

Please see if this fixes it as intended.

Comment #2

Posted on Jun 18, 2009 by Quick Hippo

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

Posted on Jun 18, 2009 by Happy Camel

Thanks. See r624.

Comment #4

Posted on Oct 27, 2010 by Happy Camel

Released: http://www.firephp.org/HQ/FinalRelease.htm

Status: Fixed

Labels:
Type-Defect Priority-Medium Milestone-FirePHPCore-0.3.2