php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41116 Bogus "indrect modification ..has no effect" warning
Submitted: 2007-04-17 12:14 UTC Modified: 2007-07-19 13:01 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: hannes dot magnusson at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5CVS-2007-04-17 (CVS) OS: FreeBSD
Private report: No CVE-ID: None
 [2007-04-17 12:14 UTC] hannes dot magnusson at gmail dot com
Description:
------------
When setting value to an object returned from an overloaded array produces bogus "Indirect modification of overloaded element of foo has no effect" warning

Reproduce code:
---------------
<?php
class foo implements ArrayAccess {
        private $array;
        public function offsetSet($key, $value) {
                $this->array[$key] = $value;
        }
        public function offsetGet($key) {
                return $this->array[$key];
        }
        public function offsetExists($key) {}
        public function offsetUnset($key) {}
}
$foo = new foo;
$std = new stdclass;

$foo["bar"] = array($std);
$foo["bar"][0]->std = "foo";
var_dump($foo);



Actual result:
--------------
Notice: Indirect modification of overloaded element of foo has no effect in /usr/home/bjori/test/bogus.warning.php on line 17
object(foo)#1 (1) {
  ["array:private"]=>
  array(1) {
    ["bar"]=>
    array(1) {
      [0]=>
      object(stdClass)#2 (1) {
        ["std"]=>
        string(3) "foo"
      }
    }
  }
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-18 14:28 UTC] jani@php.net
See also bug #42030 and bug #41641
 [2007-07-19 13:01 UTC] jani@php.net
No need to keep multiple reports open about this..see above bugs instead.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 21 00:01:27 2024 UTC