|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-04-16 13:22 UTC] acecream1 at hotmail dot com
Description: ------------ I use my custom error_handler and when it is called i throw my custom exception which is being autoloaded using spl_autoload_register when first error occours. This works normaly if Notice or Warning occours (did not test all the error types) but in case of E_DEPRECATED error the autoload is not called and i this reflects in a fatal error becouse my exception class does not exist. Reproduce code: --------------- 1. spl_autoload_register(array($class, $method)); 2. set_error_handler(array($this, 'handleError')); 3. Params\Store\Get::getInstance(&$_GET); //Call-time pass-by-reference has been deprecated D:\www\lib\framework\Framework\Params.php on line 25 Expected result: ---------------- When E_DEPRECATED error would occour i would expect that all registered autoloaders would still function inside the error handler. Actual result: -------------- Fatal error: Class 'Framework\Error\Handler\Exception' not found in D:\www\lib\framework\Framework\Params.php on line 25 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 23:00:01 2025 UTC |
This happens if you include/eval() source. It works for other errors like E_STRICT or E_NOTICE. Reproduce code: ---------------- <?php function autoload($class) { echo "Autoloader for $class\n"; eval('class '.$class.' {} '); } function error_handler($severity, $text, $file, $line, $context) { $class = 'TRIGGER_AUTOLOAD_'.$severity; $object = new $class(); echo $text."\n"; } spl_autoload_register('autoload'); set_error_handler('error_handler'); eval('$object = &new stdClass();'); ?> Expected result: ---------------- Autoloader for TRIGGER_AUTOLOAD_8192 Deprecated: Assigning the return value of new by reference is deprecated Actual result: ---------------- Fatal error: Class 'TRIGGER_AUTOLOAD_8192' not found in /<path>/bug47987.php(17) : eval()'d code on line 1