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