From: qlogix at gmail dot com
Operating system: Centos 4.1
PHP version: 5.1.2
PHP Bug Type: Scripting Engine problem
Bug description: Throwing an exception inside an exception handler catch block
causes fatal
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 bug report at http://bugs.php.net/?id=36826&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36826&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36826&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36826&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36826&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36826&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36826&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36826&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36826&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36826&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36826&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36826&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36826&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36826&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36826&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36826&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36826&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36826&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36826&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36826&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36826&r=mysqlcfg