1--TEST-- 2Bug #37667 (Object is not added into array returned by __get) 3--FILE-- 4<?php 5 6class Test 7{ 8 protected $property = array('foo' => 'bar'); 9 10 function __get($name) 11 { 12 return $this->property; 13 } 14} 15 16$obj = new Test; 17 18var_dump($obj->property['foo']); 19var_dump($obj->property[2]); 20 21var_dump($obj); 22 23$obj->property[] = 1; 24$obj->property[] = 2; 25 26var_dump($obj); 27 28?> 29--EXPECTF-- 30string(3) "bar" 31 32Warning: Undefined array key 2 in %s on line %d 33NULL 34object(Test)#%d (1) { 35 ["property":protected]=> 36 array(1) { 37 ["foo"]=> 38 string(3) "bar" 39 } 40} 41 42Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 20 43 44Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 21 45object(Test)#%d (1) { 46 ["property":protected]=> 47 array(1) { 48 ["foo"]=> 49 string(3) "bar" 50 } 51} 52