Bug #55131 [Opn]: HUITA fix this bug

From: Date: Mon, 04 Jul 2011 18:46:22 +0000
Subject: Bug #55131 [Opn]: HUITA fix this bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-161580@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55131&edit=1 ID: 55131 User updated by: archon dot saratov at gmail dot com Reported by: archon dot saratov at gmail dot com Summary: HUITA fix this bug Status: Open Type: Bug Package: *Programming Data Structures Operating System: Windows, FreeBSD PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: 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 0 => int 1 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 empty Previous Comments: ------------------------------------------------------------------------ [2011-07-04 14:44:32] archon dot saratov at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=55131&edit=1

« previous php.bugs (#161580) next »