1--TEST-- 2Testing array dereferencing on array returned from __call method 3--FILE-- 4<?php 5 6error_reporting(E_ALL); 7 8class foo { 9 public $x = array(2); 10 11 public function __call($x, $y) { 12 if (count($this->x) == 1) { 13 $this->x[] = $y[0]; 14 } 15 return $this->x; 16 } 17} 18 19$foo = new foo; 20 21$x = array(1); 22 23$foo->b($x)[1] = 3; 24 25var_dump($foo->b()[0]); 26var_dump($foo->b()[1]); 27var_dump($foo->b()[2]); 28 29?> 30--EXPECTF-- 31int(2) 32array(1) { 33 [0]=> 34 int(1) 35} 36 37Warning: Undefined array key 2 in %s on line %d 38NULL 39