#36167 [NEW]: Wrong count of the references to object

From: Date: Thu, 26 Jan 2006 15:27:10 +0000
Subject: #36167 [NEW]: Wrong count of the references to object
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-92509@lists.php.net to get a copy of this message
From: mail at ejika dot net Operating system: Windows 2000, Free BSD PHP version: 5.1.2 PHP Bug Type: Class/Object related Bug description: Wrong count of the references to object Description: ------------ Wrong count of the references to object. And wrong define object lifetime. Reproduce code: --------------- class A { function __construct() { echo 'A::__construct()<br>'; } function foo() { echo 'foo();<br>'; } function __destruct() { echo 'A::__destruct()<br>'; } } class Test { private $a; function __construct( & $a ) { $this->a = $a; echo 'Test::__construct()<br>'; } function __destruct() { $this->a->foo(); echo 'Test::__destruct()<br>'; } } $a = new A(); $t = new Test( $a ); Expected result: ---------------- A::__construct() Test::__construct() foo(); A::__destruct() Test::__destruct() Actual result: -------------- A::__construct() Test::__construct() A::__destruct() foo(); Test::__destruct() -- Edit bug report at http://bugs.php.net/?id=36167&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36167&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36167&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36167&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36167&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36167&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36167&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36167&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36167&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36167&r=support Expected behavior: http://bugs.php.net/fix.php?id=36167&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36167&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36167&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36167&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36167&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36167&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36167&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36167&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36167&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36167&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36167&r=mysqlcfg

« previous php.bugs (#92509) next »