Bug #66216 [NEW]: Uncaught exception when using set_error_handler

From: Date: Mon, 02 Dec 2013 06:51:37 +0000
Subject: Bug #66216 [NEW]: Uncaught exception when using set_error_handler
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183044@lists.php.net to get a copy of this message
From: bastiaan at basenlily dot me Operating system: Any PHP version: 5.5.6 Package: Unknown/Other Function Bug Type: Bug Bug description:Uncaught exception when using set_error_handler Description: ------------ I've used set_error_handler to create an error handler that throws an exception when a scripting error happens as described here: http://us3.php.net/manual/en/class.errorexception.php Even though I've got my commands in a try/catch block I'm getting an uncaught exception error. Works fine in 5.4, breaks on 5.6 Test script: --------------- function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new Exception('Hello world'); } set_error_handler("exception_error_handler"); try { // try loading a file that does not have exif data: $results = @exif_read_data('test.txt', 0, true); } catch (Exception $e) { echo $e-> getMessage; // "We never get here..." }; Expected result: ---------------- Expect the echo to output our error instead of raising an uncaught exception error Actual result: -------------- Fatal error: Uncaught exception 'Exception' with message 'Hello world' in /Projects/test.php on line 8 -- Edit bug report at https://bugs.php.net/bug.php?id=66216&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66216&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66216&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66216&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=66216&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=66216&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=66216&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=66216&r=needscript Try newer version: https://bugs.php.net/fix.php?id=66216&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=66216&r=support Expected behavior: https://bugs.php.net/fix.php?id=66216&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=66216&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=66216&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=66216&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66216&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=66216&r=dst IIS Stability: https://bugs.php.net/fix.php?id=66216&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=66216&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=66216&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=66216&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=66216&r=mysqlcfg

« previous php.bugs (#183044) next »