ID: 29368 Updated by: [EMAIL PROTECTED] Reported By: fixxxer at php5 dot ru -Status: Open +Status: Closed Bug Type: Zend Engine 2 problem Operating System: * PHP Version: 5.0.0 Assigned To: helly New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2004-07-24 22:43:10] fixxxer at php5 dot ru Description: ------------ The destructor is called if throwing an exception from the constructor. This seems at least illogical and it's contrary to usual behaviour of alike languages like C++ where destructor is not called in this case. Reproduce code: --------------- <? class foo { function __construct() { echo "Inside constructor\n"; throw new Exception; } function __destruct() { echo "Inside destructor\n"; } } try { $bar = new foo; } catch(Exception $exc) { echo "Caught exception!\n"; } ?> Expected result: ---------------- Inside constructor Caught exception! Actual result: -------------- Inside constructor Inside destructor Caught exception! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29368&edit=1