Bug #36759 [Com]: Objects destructors are invoked in wrong order when script is finished

From: Date: Mon, 21 Mar 2011 00:35:02 +0000
Subject: Bug #36759 [Com]: Objects destructors are invoked in wrong order when script is finished
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159651@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=36759&edit=1

 ID:                 36759
 Comment by:         stas@php.net
 Reported by:        alexander dot v at zend dot com
 Summary:            Objects destructors are invoked in wrong order when
                     script is finished
 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

 New Comment:

According to Tim Starling, still happens, details to follow soon.


Previous Comments:
------------------------------------------------------------------------
[2006-07-12 08:57:50] dmitry@php.net

Fixed in CVS HEAD and PHP_5_2.

------------------------------------------------------------------------
[2006-03-16 15:12:50] dmitry@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


Thread (14 messages)

« previous php.bugs (#159651) next »