#40024 [Opn->Csd]: Able to thrown an Exception in a Destructor
| From: | vrana@php.net | Date: | Fri, 17 Aug 2007 11:12:14 +0000 |
| Subject: | #40024 [Opn->Csd]: Able to thrown an Exception in a Destructor | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969377578@lists.php.net to get a copy of this message | ||
ID: 40024
Updated by: vrana@php.net
Reported By: php at girsbrain dot org
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Windows XP SP 2
PHP Version: 5.2.0
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
"Attempting to throw an exception from a destructor (called in the time
of script termination) causes a fatal error."
Previous Comments:
------------------------------------------------------------------------
[2007-01-10 08:52:35] dmitry@php.net
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.
------------------------------------------------------------------------
[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