1--TEST-- 2Ensure by value assignments leave temporaries on the stack, for all sorts of assignees. 3--FILE-- 4<?php 5error_reporting(E_ALL & ~E_STRICT); 6 7function f() { return 0; } 8$a[0][1] = 'good'; 9$a[1][1] = 'bad'; 10 11echo "\n" . '$i=f(): '; 12echo $a[$i=f()][++$i]; 13unset($i); 14 15echo "\n" . '$$x=f(): '; 16$x='i'; 17echo $a[$$x=f()][++$$x]; 18unset($i, $x); 19 20echo "\n" . '${\'i\'}=f(): '; 21echo $a[${'i'}=f()][++${'i'}]; 22unset(${'i'}); 23 24echo "\n" . '$i[0]=f(): '; 25echo $a[$i[0]=f()][++$i[0]]; 26unset($i); 27 28echo "\n" . '$i[0][0]=f(): '; 29echo $a[$i[0][0]=f()][++$i[0][0]]; 30unset($i); 31 32echo "\n" . '$i->p=f(): '; 33echo $a[$i->p=f()][++$i->p]; 34unset($i); 35 36echo "\n" . '$i->p->q=f(): '; 37echo $a[$i->p->q=f()][++$i->p->q]; 38unset($i); 39 40echo "\n" . '$i->p[0]=f(): '; 41echo $a[$i->p[0]=f()][++$i->p[0]]; 42unset($i); 43 44echo "\n" . '$i->p[0]->p=f(): '; 45echo $a[$i->p[0]->p=f()][++$i->p[0]->p]; 46unset($i); 47 48Class C { 49 static $p; 50} 51 52echo "\n" . 'C::$p=f(): '; 53echo $a[C::$p=f()][++C::$p]; 54 55echo "\n" . 'C::$p[0]=f(): '; 56C::$p = array(); 57echo $a[C::$p[0]=f()][++C::$p[0]]; 58 59echo "\n" . 'C::$p->q=f(): '; 60C::$p = new stdclass; 61echo $a[C::$p->q=f()][++C::$p->q]; 62?> 63--EXPECTF-- 64$i=f(): good 65$$x=f(): good 66${'i'}=f(): good 67$i[0]=f(): good 68$i[0][0]=f(): good 69$i->p=f(): 70Warning: Creating default object from empty value in %s on line %d 71good 72$i->p->q=f(): 73Warning: Creating default object from empty value in %s on line %d 74good 75$i->p[0]=f(): good 76$i->p[0]->p=f(): 77Warning: Creating default object from empty value in %s on line %d 78good 79C::$p=f(): good 80C::$p[0]=f(): good 81C::$p->q=f(): good 82