From: tyrael Operating system: linux PHP version: 5.4.0RC6 Package: Scripting Engine problem Bug Type: Bug Bug description:custom error handler throwing Exception + fatal error = no shutdown function
Description: ------------ first of all sorry for the weird Summary, I couldn't come up with a better one. it is weird. so it seems that if you have a shutdown function callback set and a custom error handler which would throw and exception and you happen to have a fatal error, the shutdown function won't be called. See the attached script, the error handler shouldn't really do anything here, because it won't be called for the fatals, but somehow it still screw things up. If I remove the error handler, I will see the "!!!shutdown!!!" printed. If I put a "return false;" before the throw I will see the "!!!shutdown!!!" printed. If I add E_NOTICE as the $error_type to the set_error_handler call I will see the "!!!shutdown!!!" printed. If I add E_WARNING as the $error_type to the set_error_handler call I will NOT see the "!!!shutdown!!!" printed. wtf? Test script: --------------- <?php register_shutdown_function(function(){echo("\n\n!!!shutdown!!!\n\n");}); set_error_handler(function($errno, $errstr, $errfile, $errline){throw new Exception("Foo");}); require 'notfound.php'; -- Edit bug report at https://bugs.php.net/bug.php?id=60909&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60909&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60909&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60909&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60909&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60909&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60909&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60909&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60909&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60909&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60909&r=support Expected behavior: https://bugs.php.net/fix.php?id=60909&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60909&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60909&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60909&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60909&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60909&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60909&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60909&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60909&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60909&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60909&r=mysqlcfg