1--TEST--
2Lazy objects: var_export initializes object
3--FILE--
4<?php
5
6class C {
7    public int $a;
8    public function __construct() {
9        var_dump(__METHOD__);
10        $this->a = 1;
11    }
12}
13
14$reflector = new ReflectionClass(C::class);
15
16print "# Ghost:\n";
17
18$obj = $reflector->newLazyGhost(function ($obj) {
19    var_dump("initializer");
20    $obj->__construct();
21});
22
23var_export($obj);
24print "\n";
25
26print "# Proxy:\n";
27
28$obj = $reflector->newLazyProxy(function ($obj) {
29    var_dump("initializer");
30    return new C();
31});
32
33var_export($obj);
34print "\n";
35--EXPECTF--
36# Ghost:
37string(11) "initializer"
38string(14) "C::__construct"
39\C::__set_state(array(
40   'a' => 1,
41))
42# Proxy:
43string(11) "initializer"
44string(14) "C::__construct"
45\C::__set_state(array(
46   'a' => 1,
47))
48