#30413 [NEW]: __set called for wrong object

From: Date: Tue, 12 Oct 2004 17:14:02 +0000
Subject: #30413 [NEW]: __set called for wrong object
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67488@lists.php.net to get a copy of this message
From: info at pandora-web dot de Operating system: Linux 2.6 PHP version: 5.0.2 PHP Bug Type: Zend Engine 2 problem Bug description: __set called for wrong object 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 /> -- Edit bug report at http://bugs.php.net/?id=30413&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30413&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30413&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30413&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30413&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30413&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30413&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30413&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30413&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30413&r=support Expected behavior: http://bugs.php.net/fix.php?id=30413&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30413&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30413&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30413&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30413&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30413&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30413&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30413&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30413&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30413&r=mysqlcfg

« previous php.bugs (#67488) next »