From: Operating system: Windows, FreeBSD PHP version: 5.3.6 Package: *Programming Data Structures Bug Type: Bug Bug description:HUITA fix this bug
Description: ------------ bad working a __get method Test script: --------------- <?php class C1 { protected $arr = array( 'e1' => array() ); public function __get($propertyName) { if(isset($this->arr[$propertyName])) return $this->arr[$propertyName]; } public function __set($propertyName, $value) { if(isset($this->arr[$propertyName])) $this->arr[$propertyName] = $value; } } $c1 = new C1(); var_dump($c1->e1); $c1->e1[] = 1; var_dump($c1->e1); Expected result: ---------------- array empty array empty Actual result: -------------- array empty ( ! ) Notice: Indirect modification of overloaded property C1::$e1 has no effect in E:\Server\xampp\htdocs\test.php on line 18 array 0 => int 1 -- Edit bug report at https://bugs.php.net/bug.php?id=55131&edit=1 -- Try a snapshot (PHP 5.2): https://bugs.php.net/fix.php?id=55131&r=trysnapshot52 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55131&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55131&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55131&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55131&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55131&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55131&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55131&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55131&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55131&r=support Expected behavior: https://bugs.php.net/fix.php?id=55131&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55131&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55131&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55131&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55131&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55131&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55131&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55131&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55131&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55131&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55131&r=mysqlcfg Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55131&r=trysnapshot54