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