--TEST-- Lazy objects: json_encode with dynamic props on initialized object --FILE-- newLazyGhost(function ($obj) { $obj->dyn = 1; }); test('Ghost', $obj); $obj = $reflector->newLazyProxy(function () { $c = new C(); $c->dyn = 1; return $c; }); test('Proxy', $obj); --EXPECTF-- # Ghost object(stdClass)#%d (2) { ["a"]=> int(1) ["dyn"]=> int(1) } # Proxy object(stdClass)#%d (2) { ["a"]=> int(1) ["dyn"]=> int(1) }