#47771 [Opn->Csd]: Exception during object construction from arg call calls object's destructor
| From: | dmitry@php.net | Date: | Thu, 26 Mar 2009 10:18:04 +0000 |
| Subject: | #47771 [Opn->Csd]: Exception during object construction from arg call calls object's destructor | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-135146@lists.php.net to get a copy of this message | ||
ID: 47771
Updated by: dmitry@php.net
Reported By: ninzya at inbox dot lv
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.3.0RC1
-Assigned To:
+Assigned To: dmitry
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:
------------------------------------------------------------------------
[2009-03-25 07:38:06] ninzya at inbox dot lv
Description:
------------
If you create new object and pass to it's constructor argument from
function call, that has thrown an exception, the object's constructor is
not being called (which is correct behavior), but object's destructor is
being called (which is not correct behavior). See reproduce code.
Reproduce code:
---------------
<?php
function throw_exc() {
throw new Exception('TEST_EXCEPTION');
}
class Test {
public function __construct() {
echo 'Constr' ."\n";
}
public function __destruct() {
echo 'Destr' ."\n";
}
}
try {
$T =new Test( throw_exc());
} catch( Exception $e) {
echo 'Exception: ' .$e->getMessage();
}
?>
Expected result:
----------------
Exception: TEST_EXCEPTION
Actual result:
--------------
Destr
Exception: TEST_EXCEPTION
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47771&edit=1