|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-26 16:48 UTC] tony2001@php.net
[2006-01-27 16:12 UTC] mail at ejika dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 15:00:01 2025 UTC |
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()