#36167 [Opn->Bgs]: Wrong count of the references to object

From: Date: Thu, 26 Jan 2006 15:48:09 +0000
Subject: #36167 [Opn->Bgs]: Wrong count of the references to object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-92511@lists.php.net to get a copy of this message
ID: 36167 Updated by: tony2001@php.net Reported By: mail at ejika dot net -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows 2000, Free BSD PHP Version: 5.1.2 New Comment: See bug #33348 Previous Comments: ------------------------------------------------------------------------ [2006-01-26 16:27:09] mail at ejika dot net 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 this bug report at http://bugs.php.net/?id=36167&edit=1

« previous php.bugs (#92511) next »