|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-08-05 11:02 UTC] johannes@php.net
-Status: Open
+Status: Bogus
[2010-08-05 11:02 UTC] johannes@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 07:00:02 2025 UTC |
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