|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40625 Indirect modification of overloaded property
Submitted: 2007-02-25 03:18 UTC Modified: 2007-02-25 19:35 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.1 OS: XP SP2
Private report: No CVE-ID: None
 [2007-02-25 03:18 UTC]
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 "


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-25 19:35 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

It didn\'t work properly before either, and now we warn about it.
 [2013-11-28 10:06 UTC] martijn dot otto at copernica dot com
This bug is now almost five years old and still has not been fixed. Stating that is has never worked before and it gives a notice about this lack of functionality is of course no excuse to close this bug.

I would like to see this issue fixed.
 [2013-11-28 14:22 UTC]
@martijn: Everything works fine, you just have to return from __get by reference (write &__get instead of just __get).
 [2013-11-28 14:39 UTC] martijn dot otto at copernica dot com
Ah, that seems to work, thank you.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC