|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-10-12 23:26 UTC] info at pandora-web dot de
[2004-10-13 09:19 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 23:00:01 2025 UTC |
Description: ------------ When using overloaded Objects in Overloaded Object, then the __set method of the first object is called instead of the last Object in chain. Reproduce code: --------------- class TestClass { private $_p = array(); public function __get($propName){ return $this->_p[$propName]; } public function __set($propName, $propValue){ $this->_p[$propName] = $value; } } $a = new TestClass(); $a->TestVar = 'test'; print $a->testVar; //--> 'test' $a->testVar = new TestClass(); $a->testVar->testVar = 'test2'; // __set of $a->testVar called instead of getter of $a->testVar and setter of $a->testVar->testVar Expected result: ---------------- I think I is better to call the __get method of the first objects and than the __set method of the last one in chain. Actual result: -------------- <br /> <b>Fatal error</b>: Cannot access undefined property for object with overloaded property access in <b>xxxx</b> on line <b>xxxx</b><br />