#40024 [Opn]: Able to thrown an Exception in a Destructor
| From: | php at girsbrain dot org | Date: | Thu, 04 Jan 2007 18:02:24 +0000 |
| Subject: | #40024 [Opn]: Able to thrown an Exception in a Destructor | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-107178@lists.php.net to get a copy of this message | ||
ID: 40024
User updated by: php at girsbrain dot org
Reported By: php at girsbrain dot org
Status: Open
Bug Type: Class/Object related
Operating System: Windows XP SP 2
PHP Version: 5.2.0
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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