From: ich at christoph-emonds dot de
Operating system: Gentoo Linux 2.4.20
PHP version: 5CVS-2003-09-15 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: destructor won't be called
Description:
------------
If you create two objects which contain a reference to the
other object, none of both __destruct() functions will be
called.
Configure: './configure' '--with-mysql' '--with-xsl'
'--with-sqlite' '--enable-sockets' '--with-mysql-sock'
'--with-gd' '--with-dom' '--with-apxs2=/usr/sbin/apxs2'
'--with-zlib'
Reproduce code:
---------------
class A {
function __construct() {
print "Construct A!";
$this->other = new B( $this );
}
function __destruct() {
print "Destruct A!";
}
}
class B {
function __construct( A $obj ) {
print "Construct B!";
$this->other = $obj;
}
function __destruct() {
print "Destruct B!";
}
}
new A();
Expected result:
----------------
Construct A!Construct B!Destruct A!Destruct B!
Actual result:
--------------
Construct A!Construct B!
--
Edit bug report at http://bugs.php.net/?id=25541&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25541&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25541&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25541&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25541&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25541&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25541&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25541&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25541&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25541&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25541&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25541&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25541&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25541&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25541&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25541&r=gnused