1--TEST-- 2Lazy objects: initialization of proxy does not change object id 3--FILE-- 4<?php 5 6class MyObject { 7 public $a; 8} 9 10$reflector = new ReflectionClass(MyObject::class); 11 12$object = new MyObject(); 13$objectId = spl_object_id($object); 14 15$reflector->resetAsLazyProxy($object, function (MyObject $object) use (&$object2Id) { 16 $object2 = new MyObject(); 17 $object2Id = spl_object_id($object2); 18 return $object2; 19}); 20var_dump(spl_object_id($object) === $objectId); 21$reflector->initializeLazyObject($object); 22var_dump(spl_object_id($object) === $objectId); 23var_dump(spl_object_id($object) !== $object2Id); 24 25?> 26--EXPECT-- 27bool(true) 28bool(true) 29bool(true) 30