1--TEST--
2Lazy objects: setRawValueWithoutLazyInitialization() may realize object if last lazy prop
3--FILE--
4<?php
5
6class C {
7    public $a;
8    public $b;
9}
10
11function test(string $name, object $obj) {
12    printf("# %s\n", $name);
13
14    $reflector = new ReflectionClass(C::class);
15    $reflector->getProperty('a')->setRawValueWithoutLazyInitialization($obj, 'test');
16    $reflector->getProperty('b')->setRawValueWithoutLazyInitialization($obj, 'test');
17
18    var_dump(!$reflector->isUninitializedLazyObject($obj));
19    var_dump($obj);
20}
21
22$reflector = new ReflectionClass(C::class);
23$obj = $reflector->newLazyGhost(function () {
24    throw new \Exception('initializer');
25});
26
27test('Ghost', $obj);
28
29$obj = $reflector->newLazyProxy(function () {
30    throw new \Exception('initializer');
31});
32
33test('Proxy', $obj);
34
35?>
36--EXPECTF--
37# Ghost
38bool(true)
39object(C)#%d (2) {
40  ["a"]=>
41  string(4) "test"
42  ["b"]=>
43  string(4) "test"
44}
45# Proxy
46bool(true)
47object(C)#%d (2) {
48  ["a"]=>
49  string(4) "test"
50  ["b"]=>
51  string(4) "test"
52}
53