#40625 [Opn->Bgs]: Indirect modification of overloaded property
| From: | derick@php.net | Date: | Sun, 25 Feb 2007 19:35:31 +0000 |
| Subject: | #40625 [Opn->Bgs]: Indirect modification of overloaded property | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-109499@lists.php.net to get a copy of this message | ||
ID: 40625
Updated by: derick@php.net
Reported By: noreply@php.net
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: XP SP2
PHP Version: 5.2.1
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
It didn't work properly before either, and now we warn about it.
Previous Comments:
------------------------------------------------------------------------
[2007-02-25 03:18:29] noreply@php.net
Description:
------------
While using __get and __set im getting the following notice : "Notice:
Indirect modification of overloaded property $var has no effect "
It worked perfect in previous PHP versions.
Reproduce code:
---------------
class myclass
{
/*
$this->_data =
array(1) {
["abcd"] => array(2) {
["a"] => string(2) "cc"
["b"] => string(2) "dd"
}
}
*/
public function __get($name)
{
$result = null;
if (isset($this->_data[$name])) {
$result = $this->_data[$name];
}
return (array)$this->_data[$name] ;
}
public function __set($value, $arg)
{
foreach($arg as $key=>$inhoud) {
$this->_data[$value][$key] = $inhoud;
}
}
}
$myclass = new myclass();
$myclass->abcd['a'] = 'ee'; //does not work anymore
$myclass->newNode['a'] = 'ee'; //does not work anymore
Expected result:
----------------
array(2) {
["abcd"] => array(2) {
["a"] => string(2) "ee"
["b"] => string(2) "dd"
}
["newNode"] => string(2) "ee"
}
Actual result:
--------------
Data does not change and outputs "Notice: Indirect modification of
overloaded property $var has no effect "
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40625&edit=1