ID: 36826 Updated by: [EMAIL PROTECTED] Reported By: qlogix at gmail dot com -Status: Assigned +Status: Bogus Bug Type: Scripting Engine problem Operating System: Centos 4.1 PHP Version: 5.1.2 Assigned To: dmitry New Comment:
Yes. exception_handler, that is set with set_exception_handler(), catches exceptions those are uncaught by PHP script. The handler is not executed in context of PHP script (it is executed without any context), and it cannot throw exceptions. Previous Comments: ------------------------------------------------------------------------ [2006-04-11 11:27:08] [EMAIL PROTECTED] Dmitry, I think this was intentional behaviour, but can you confirm this? ------------------------------------------------------------------------ [2006-03-22 22:43:38] qlogix at gmail dot com Description: ------------ Throwing an exception from inside a catch block within an exception handler function causes a fatal error. If I comment out the marked line, the fatal error does not occur. I would expect PHP to re-call the master exception handler function. Reproduce code: --------------- class TestException extends Exception { } set_exception_handler('handler'); function handler($ex) { /* Just to rule out recursion */ if ($ex instanceof TestException) { die("Recursion"); } try { /* This is where I would attempt to write to the db */ throw new Exception("someDBFunction failed"); } catch (Exception $ex) { /* If I comment out the following line, the error goes away */ throw new TestException("The db logging function failed..write to file."); } } throw new Exception("Ex"); Expected result: ---------------- The script should die with the message "Recursion" Actual result: -------------- Fatal error: Exception thrown without a stack frame in Unknown on line 0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36826&edit=1