#40024 [Asn->Opn]: Able to thrown an Exception in a Destructor
| From: | dmitry@php.net | Date: | Wed, 10 Jan 2007 08:52:35 +0000 |
| Subject: | #40024 [Asn->Opn]: Able to thrown an Exception in a Destructor | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-107410@lists.php.net to get a copy of this message | ||
ID: 40024
Updated by: dmitry@php.net
Reported By: php at girsbrain dot org
-Status: Assigned
+Status: Open
Bug Type: Class/Object related
Operating System: Windows XP SP 2
PHP Version: 5.2.0
Assigned To: dmitry
New Comment:
This is a documentation bug.
The "PHP Fatal error: Exception thrown without a stack frame" is
occurs only if exception thrown during PHP script shutdown, however
objects that are destroied during script execution can throw exception
from destructors without problem.
Previous Comments:
------------------------------------------------------------------------
[2007-01-04 18:17:54] garmoan at gmail dot com
Tested on Mac OSX with PHP 6.0.0-dev
same results
------------------------------------------------------------------------
[2007-01-04 18:02:23] php at girsbrain dot org
Tested on CentOS 2.6.9-42.0.2.ELsmp #1 SMP Wed Aug 23 13:38:27 BST 2006
GNU/Linux with PHP 5.1.6, got the same result.
------------------------------------------------------------------------
[2007-01-04 17:57:13] php at girsbrain dot org
Description:
------------
On the Constructor/Destructor page in the manual, the last note states
that "Attempting to throw an exception from a destructor causes a fatal
error." I've come into a scenario where I am able to throw an Exception,
without fail, from a Destructor.
Below are just two examples, I'm sure there are more.
Reproduce code:
---------------
http://www.girsbrain.org/php_bugs/exception_deconstructor_01.phps
http://www.girsbrain.org/php_bugs/exception_deconstructor_02.phps
Expected result:
----------------
Fatal error: Exception thrown without a stack frame in Unknown on line
0
Actual result:
--------------
This should produce a Fatal error, but it doesn't
#0 \test.php(10): TestClass->__destruct()
#1 {main}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40024&edit=1