From: Operating system: Windows XP PHP version: 5.3.3 Package: Class/Object related Bug Type: Bug Bug description:Error on update array's field through __set magic method
Description: ------------ If I use __set magic method for arrays and try to update some field of array I see the old value. But, if I use the same scheme for ArrayObject I'll get the right result. Test script: --------------- <? class t { private $data = array(); public function __get($name) { return $this->data[$name]; } public function __set($name, $value) { $this->data[$name] = $value; } } // define test array $array = array( 'view' => array('x' => 1, 'y' => 1) ); $t = new t(); $t->mas = $array; // update field of array $t->mas['view']['x'] = 1111; echo $t->mas['view']['x']; echo '<br>'; $t->mas2 = new ArrayObject($array); $t->mas2['view']['x'] = 1111; echo $t->mas2['view']['x']; ?> Expected result: ---------------- 1111 <br> 1111 Actual result: -------------- 1 <br> 1111 -- Edit bug report at http://bugs.php.net/bug.php?id=52540&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52540&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52540&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52540&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52540&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52540&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52540&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52540&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52540&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52540&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52540&r=support Expected behavior: http://bugs.php.net/fix.php?id=52540&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52540&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52540&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52540&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52540&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52540&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52540&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52540&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52540&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52540&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52540&r=mysqlcfg