1--TEST-- 2Lazy objects: fatal error during initialization of ghost object 3--FILE-- 4<?php 5 6class C { 7 public $a; 8 public $b; 9 public $c; 10 public function __construct() { 11 eval('{'); 12 } 13} 14 15$reflector = new ReflectionClass(C::class); 16$obj = $reflector->newLazyGhost(function ($obj) { 17 var_dump("initializer"); 18 $obj->__construct(); 19}); 20 21$reflector->getProperty('b')->setRawValueWithoutLazyInitialization($obj, new stdClass); 22 23var_dump($obj); 24var_dump($obj->c); 25var_dump($obj); 26 27--EXPECTF-- 28lazy ghost object(C)#%d (1) { 29 ["b"]=> 30 object(stdClass)#%d (0) { 31 } 32} 33string(11) "initializer" 34 35Parse error: Unclosed '{' in %s on line %d 36