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

From: Date: Tue, 03 Dec 2013 05:15:15 +0000
Subject: Bug #66216 [Opn]: Uncaught exception when using set_error_handler
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183079@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66216&edit=1 ID: 66216 User updated by: bastiaan at basenlily dot me Reported by: bastiaan at basenlily dot me Summary: Uncaught exception when using set_error_handler Status: Open Type: Bug Package: Unknown/Other Function Operating System: Any PHP Version: 5.5.6 Block user comment: N Private report: N New Comment: Hey laruence, Sorry for the typo, I was copying the code from my real project. Should have ran it. That said, corrected the typo and it is still behaving exactly the same: Fatal error: Uncaught exception 'Exception' with message 'Hello world' in /Projects/web/test/bug.php on line 3 So far I've tested this on a machine running Mac OS X 10.8.6 and one running Windows (2012 server I think). Previous Comments: ------------------------------------------------------------------------ [2013-12-02 08:11:04] laruence@php.net there is a typo in your example: should be: echo $e->getMessage(); after fixed that, I can not reproduce the bug you were describing ------------------------------------------------------------------------ [2013-12-02 06:51:36] bastiaan at basenlily dot me 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 this bug report at https://bugs.php.net/bug.php?id=66216&edit=1

« previous php.bugs (#183079) next »