|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-10-27 19:51 UTC] sterling@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 09:00:01 2025 UTC |
Normally this code should print "0", however, when uncommenting a single empty method call, it outputs "1". It seems like a copy suddenly becomes a reference. <?php $a1 = new A(); //$a1->c->f(); // uncomment this to expose error. $a2 = $a1; $a2->c->x = 1; echo $a1->c->x; class C { var $x = 0; function f() {} } class A { var $c; function A() { $this->c = new C(); } } ?> Thanks. Anahoret Team.