ID: 39706 Updated by: [EMAIL PROTECTED] Reported By: magic dot bitbucket at gmail dot com -Status: Open +Status: Assigned Bug Type: Scripting Engine problem Operating System: GNU/Linux - Slackware 11 PHP Version: 5.2.0 -Assigned To: +Assigned To: dmitry
Previous Comments: ------------------------------------------------------------------------ [2006-12-01 16:34:36] magic dot bitbucket at gmail dot com Description: ------------ When throwing an Exception and not catching it, Object destructors don't get called. I don't know if this is a bug or a feature, but surely it isn't expected behaviour and it isn't documented. This allows Objects to go out of scope without the destructor being called and makes destructors useless as cleanup has to be done manually before even thinking about throwing an Exception. Reproduce code: --------------- #!/usr/bin/php <?php class ExceptionTest { public function __construct(){} public function __destruct() { echo "hilfe mein leben!\n"; } } $test=new ExceptionTest(); throw new Exception('why are the destructors not called?', 666); ?> Expected result: ---------------- I would expect __destruct() to be called when throwing the Exception. Actual result: -------------- __destruct() isn't called. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39706&edit=1