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(): '; 32echo $a[$i->p=f()][++$i->p]; 33unset($i); 34 35echo "\n" . '$i->p->q=f(): '; 36echo $a[$i->p->q=f()][++$i->p->q]; 37unset($i); 38 39echo "\n" . '$i->p[0]=f(): '; 40echo $a[$i->p[0]=f()][++$i->p[0]]; 41unset($i); 42 43echo "\n" . '$i->p[0]->p=f(): '; 44echo $a[$i->p[0]->p=f()][++$i->p[0]->p]; 45unset($i); 46 47Class C { 48 static $p; 49} 50 51echo "\n" . 'C::$p=f(): '; 52echo $a[C::$p=f()][++C::$p]; 53 54echo "\n" . 'C::$p[0]=f(): '; 55C::$p = array(); 56echo $a[C::$p[0]=f()][++C::$p[0]]; 57 58echo "\n" . 'C::$p->q=f(): '; 59C::$p = new stdclass; 60echo $a[C::$p->q=f()][++C::$p->q]; 61?> 62--EXPECTF-- 63$i=f(): good 64$$x=f(): good 65${'i'}=f(): good 66$i[0]=f(): good 67$i[0][0]=f(): good 68$i->p=f(): 69Warning: Creating default object from empty value in %s on line %d 70good 71$i->p->q=f(): 72Warning: Creating default object from empty value in %s on line %d 73 74Warning: Creating default object from empty value in %s on line %d 75good 76$i->p[0]=f(): 77Warning: Creating default object from empty value in %s on line %d 78good 79$i->p[0]->p=f(): 80Warning: Creating default object from empty value in %s on line %d 81 82Warning: Creating default object from empty value in %s on line %d 83good 84C::$p=f(): good 85C::$p[0]=f(): good 86C::$p->q=f(): good 87