1--TEST--
2Lazy objects: JIT: ASSIGN_OBJ with unknown prop info
3--FILE--
4<?php
5
6class C {
7    // Private prop so that prop_info is not inferred
8    private int $a;
9    public int $b;
10    function __construct() {
11        $this->b = 2;
12    }
13    function test(object $obj) {
14        $obj->a = 1;
15    }
16}
17
18$reflector = new ReflectionClass(C::class);
19
20for ($i = 0; $i < 2; $i++) {
21    $obj = $reflector->newLazyGhost(function ($obj) {
22        var_dump("initializer");
23        $obj->__construct();
24    });
25    // Call via reflection to avoid inlining.
26    // - test() handlers are executed once, and prime the runtime cache
27    // - On subsequent calls, the JIT'ed code is used, and we enter the valid runtime cache path
28    $reflector->getMethod('test')->invoke($obj, $obj);
29    var_dump($obj);
30}
31
32--EXPECTF--
33string(11) "initializer"
34object(C)#%d (2) {
35  ["a":"C":private]=>
36  int(1)
37  ["b"]=>
38  int(2)
39}
40string(11) "initializer"
41object(C)#%d (2) {
42  ["a":"C":private]=>
43  int(1)
44  ["b"]=>
45  int(2)
46}
47