|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-08-22 17:54 UTC] sniper@php.net
[2005-08-29 17:59 UTC] vrana@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 18:00:01 2025 UTC |
Description: ------------ When performing an operation which throws an exception in the __destruct method of a class, the following Error is generated Fatal error: Exception thrown without a stack frame in Unknown on line 0 I have only observed this happening when an object goes out of scope because the script has ended. Rather than generating a scripting engine error, PHP should allow for the script to deal with the error, for instance when an exception handler has been specified by the script. Reproduce code: --------------- class test { function __construct() { echo "Construct\n"; } function greet() { echo "Hello World\n"; } function __destruct() { echo "Destruct\n"; throw new Exception( 'test' ); } } $test = new test(); $test->greet(); Expected result: ---------------- Construct Hello World Destruct Fatal error: Uncaught exception 'Exception' with message 'test' in /home/crazzeto/test.php:13 Stack trace: #0 /home/crazzeto/test.php(13): test::__destruct() #1 /home/crazzeto/test.php(20): test::__destruct() #2 /home/crazzeto/test.php(20): unknown() #3 {main} thrown in /home/crazzeto/test.php on line 13 Actual result: -------------- [crazzeto@DEVEL crazzeto]$ php test.php Construct Hello World Destruct Fatal error: Exception thrown without a stack frame in Unknown on line 0