1--TEST-- 2Handling of new in constant expressions in reflection 3--FILE-- 4<?php 5 6function test1() { 7 static $x = new stdClass; 8 return $x; 9} 10 11$rf = new ReflectionFunction('test1'); 12var_dump($rf->getStaticVariables()); 13test1(); 14 15$s = $rf->getStaticVariables(); 16var_dump($s['x'] === test1()); 17 18function test2($x = new stdClass) { 19 return $x; 20} 21 22$rf = new ReflectionFunction('test2'); 23$rp = $rf->getParameters()[0]; 24// Parameter default should *not* be the same. 25var_dump($rp->getDefaultValue() !== test2()); 26 27?> 28--EXPECT-- 29array(1) { 30 ["x"]=> 31 NULL 32} 33bool(true) 34bool(true) 35