--TEST-- Lazy objects: clone: initializer exception --FILE-- getMessage()); } var_dump($reflector->isUninitializedLazyObject($obj)); var_dump($obj); } $reflector = new ReflectionClass(C::class); $obj = $reflector->newLazyGhost(function ($obj) { throw new \Exception('initializer'); }); test('Ghost', $obj); $obj = $reflector->newLazyProxy(function ($obj) { throw new \Exception('initializer'); }); test('Proxy', $obj); --EXPECTF-- # Ghost: Exception: initializer bool(true) lazy ghost object(C)#%d (0) { } # Proxy: Exception: initializer bool(true) lazy proxy object(C)#%d (0) { }