From:             public at syranide dot com
Operating system: Windows XP 32bit
PHP version:      5.2.0
PHP Bug Type:     Scripting Engine problem
Bug description:  Shutdown breaks exception model

Description:
------------
Exceptions is a very nice addition to PHP5, however functions registered
with register_shutdown_function breaks this nice exception model.

A function called during shutdown apparently does not have a stack, so
when an exception is thrown and is caught by the engine, instead of
forwarding the error to the registered exception handler a fatal error is
produced detailing nothing of the actual problem, only that the there is
no stack.

This is counter-intuitive as to the neat exception model, each function
must now internally catch all exceptions and output them.

Suggestion: forward the exception to the registered exception handler (I
can't see any problem in this as it is possible to catch the exception
yourself and pass it on to the exception handler).

Reproduce code:
---------------
register_shutdown_function('nostack');
function nostack() {
        throw new Exception();
}

Expected result:
----------------
Fatal error:  Uncaught exception 'Exception' in C:\php\test.php:4
Stack trace:
#0 C:\php\test.php(2): nostack()
#1 {main} thrown in C:\php\test.php on line 4

Actual result:
--------------
Fatal error:  Exception thrown without a stack frame in Unknown on line 0

-- 
Edit bug report at http://bugs.php.net/?id=40043&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40043&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40043&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40043&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40043&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40043&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40043&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40043&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40043&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40043&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40043&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40043&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40043&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40043&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40043&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40043&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40043&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40043&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40043&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40043&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40043&r=mysqlcfg

Reply via email to