|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-06-16 22:25 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 17:00:01 2025 UTC |
Description: ------------ There is a bug in creating references (This problem does not exist in PHP5). If you have, for example, two classes and the first class creates second and passes itself as reference to second's constructor, reference is not being created. I've been trying to create this reference in many ways, but always with the same result - there is no reference, only a copy of class which was passed as reference. Reproduce code: --------------- class B { var $Parent; function B(&$parent) { $this->Parent = $parent; $this->Parent->Data = 'foo'; } } class A { var $Data; var $B; function A() { $this->B = new B($this); } } $a = new A; echo $a->Data; Expected result: ---------------- echo should return 'foo', but returns nothing. In php5 it works properly. Note, that I have used the & operator in B's constructor to create a reference to A class.