|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-01-06 13:48 UTC] public at syranide dot com
[2007-01-06 16:44 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 13:00:02 2025 UTC |
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