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