Edit report at http://bugs.php.net/bug.php?id=36759&edit=1
ID: 36759 Updated by: s...@php.net Reported by: alexander dot v at zend dot com Summary: Objects destructors are invoked in wrong order when script is finished -Status: Closed +Status: Assigned Type: Bug Package: Scripting Engine problem Operating System: all PHP Version: 5CVS-2006-03-16 (snap) Assigned To: dmitry Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2006-07-12 08:57:50] dmi...@php.net Fixed in CVS HEAD and PHP_5_2. ------------------------------------------------------------------------ [2006-03-16 15:12:50] dmi...@php.net Reproduce code: --------------- <?php class Foo { private $bar; function __construct($bar) { $this->bar = $bar; } function __destruct() { echo __METHOD__,"\n"; unset($this->bar); } } class Bar { function __destruct() { echo __METHOD__,"\n"; unset($this->bar); } } $y = new Bar(); $x = new Foo($y); ?> Expected result: ---------------- Foo::__destruct Bar::__destruct Actual result: -------------- Bar::__destruct Foo::__destruct ------------------------------------------------------------------------ [2006-03-16 15:02:04] alexander dot v at zend dot com Description: ------------ Object destructors are invoked in an arbitrarily order. Objects from a global_symbol_table should be destructed first. Reproduce code: --------------- too large and not deterministic Expected result: ---------------- none Actual result: -------------- none ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=36759&edit=1