#36826 [Opn->Asn]: Throwing an exception inside an exception handler catch block causes fatal

From: Date: Tue, 11 Apr 2006 11:27:08 +0000
Subject: #36826 [Opn->Asn]: Throwing an exception inside an exception handler catch block causes fatal
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95592@lists.php.net to get a copy of this message
ID: 36826 Updated by: sniper@php.net Reported By: qlogix at gmail dot com -Status: Open +Status: Assigned Bug Type: Scripting Engine problem Operating System: Centos 4.1 PHP Version: 5.1.2 -Assigned To: +Assigned To: dmitry New Comment: Dmitry, I think this was intentional behaviour, but can you confirm this? Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#95592) next »