From: Operating system: Windows 7 x64 PHP version: 5.3.8 Package: Scripting Engine problem Bug Type: Bug Bug description:register_shutdown_function() not called in combination with set_error_handler()
Description: ------------ My PHP version is: PHP Version 5.3.8-ZS5.5.0, but this bug exist in the Linux environment also. Checked in Debian with PHP 5.3.8. In the set_error_handler() documentation we have the following quote: "The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called." According this quote the bug should not occur if specified error types will not be raised in the file where set_error_handler() is called. Let's try to implement such condition. Test script: --------------- -- set_error_handler.php -- <?php $foo = new \Foo\MyErrorHandler(); set_error_handler(array($foo, 'errorHandler')); // we call the set_error_handler() in the other file. set_exception_handler(array($foo, 'exceptionHandler')); register_shutdown_function(array($foo, 'fatalErrorHandler')); ?> -- end of set_error_handler.php -- -- bug -- namespace Foo; class MyErrorHandler { function errorHandler() { echo __METHOD__ . "\n"; throw new \Exception('test'); } function exceptionHandler() { echo __METHOD__ . "\n"; // should be called! } function fatalErrorHandler() { echo __METHOD__ . "\n"; // should be called! } } require_once __DIR__ . '/set_error_handler.php'; require_once __DIR__ . '/not_existing_file.php'; // file should not exist die(); -- end of bug -- Expected result: ---------------- Foo\MyErrorHandler::errorHandler Foo\MyErrorHandler::exceptionHandler Foo\MyErrorHandler::fatalErrorHandler // should be called at least! Fatal error: main() [function.require]: Failed opening required 'X:\home\localhost\www/not_existing_file.php' (include_path='D:\system\home\projects\myak\www\includes') in X:\home\localhost\www\test.php on line 28 Actual result: -------------- Foo\MyErrorHandler::errorHandler Fatal error: main() [function.require]: Failed opening required 'X:\home\localhost\www/not_existing_file.php' (include_path='D:\system\home\projects\myak\www\includes') in X:\home\localhost\www\test.php on line 28 -- Edit bug report at https://bugs.php.net/bug.php?id=60211&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60211&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60211&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60211&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60211&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60211&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60211&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60211&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60211&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60211&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60211&r=support Expected behavior: https://bugs.php.net/fix.php?id=60211&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60211&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60211&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60211&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60211&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60211&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60211&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60211&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60211&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60211&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60211&r=mysqlcfg