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

From: Date: Fri, 27 Jan 2006 15:12:12 +0000
Subject: #36167 [Bgs]: Wrong count of the references to object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-92549@lists.php.net to get a copy of this message
ID: 36167 User updated by: mail at ejika dot net Reported By: mail at ejika dot net Status: Bogus Bug Type: Class/Object related Operating System: Windows 2000, Free BSD PHP Version: 5.1.2 New Comment: Php don't clean memory using by object after __destruction of object request. Previous Comments: ------------------------------------------------------------------------ [2006-01-26 16:48:08] tony2001@php.net See bug #33348 ------------------------------------------------------------------------ [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 (#92549) next »