ID: 49499 Updated by: sjo...@php.net Reported By: ies_clan at hotmail dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows XP home PHP Version: 5.3.0 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The __get() function returns a reference to the array, and this reference is used to change the array. Previous Comments: ------------------------------------------------------------------------ [2009-09-08 11:32:21] ies_clan at hotmail dot com Description: ------------ look @ the code.... Reproduce code: --------------- <?php error_reporting(E_ALL); class newclass { private $properties; public function &__get($key) { echo "get $key<br>"; return $this->properties[$key]; } public function __set($key, $val) { echo "set $key to $val<br>"; $this->properties[$key] = $val; } } $c = new newclass; $c->array['test'] = 'test'; Expected result: ---------------- get array set array to test Actual result: -------------- get array ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49499&edit=1