1--TEST--
2Lazy objects: setRawValueWithoutLazyInitialization() does not call __set()
3--FILE--
4<?php
5
6class C {
7    public $a;
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')->setRawValueWithoutLazyInitialization($obj, 'test');
20
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
41bool(false)
42lazy ghost object(C)#%d (1) {
43  ["a"]=>
44  string(4) "test"
45}
46# Proxy
47bool(false)
48lazy proxy object(C)#%d (1) {
49  ["a"]=>
50  string(4) "test"
51}
52