From: Operating system: all PHP version: 5.3.5 Package: Scripting Engine problem Bug Type: Bug Bug description:Exception thrown in error_handler is swallowed
Description: ------------ Exception thrown in error_handler is swallowed if fatal error occurs after error in same instruction somewhat related (closed) bugs: http://bugs.php.net/bug.php?id=36773 http://bugs.php.net/bug.php?id=51463 Test script: --------------- function error($code, $message, $file = null, $line = 0) { echo "convert error to exception<br>\n"; throw new \ErrorException($message, $code, null, $file, $line); } function shutdown() { echo "shutdown function called<br>\n"; } set_error_handler('error'); register_shutdown_function('shutdown'); try { echo $crypto->compress(); } catch (\Exception $e) { echo "exception catched<br>\n"; } echo "after fatal error<br>\n"; Expected result: ---------------- exception should be catched as in (note the @ operator to suppress a FATAL ERROR!): function error($code, $message, $file = null, $line = 0) { echo "convert error to exception<br>\n"; throw new \ErrorException($message, $code, null, $file, $line); } function shutdown() { echo "shutdown function called<br>\n"; } set_error_handler('error'); register_shutdown_function('shutdown'); try { echo @$crypto->compress(); } catch (\Exception $e) { echo "exception catched<br>\n"; } echo "after fatal error<br>\n"; Actual result: -------------- 1. Exception thrown in error_handler is swallowed 2. the "fatal error" after "Undefined variable" occurs -- Edit bug report at http://bugs.php.net/bug.php?id=54275&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54275&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54275&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54275&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54275&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54275&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54275&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54275&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54275&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54275&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54275&r=support Expected behavior: http://bugs.php.net/fix.php?id=54275&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54275&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54275&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54275&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54275&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54275&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54275&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54275&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54275&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54275&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54275&r=mysqlcfg
