|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-26 10:18 UTC] dmitry@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 00:00:02 2025 UTC |
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