xref: /PHP-8.2/ext/opcache/tests/jit/gh12380.phpt (revision fb683877)
1--TEST--
2GH-12380: JIT+private array property access inside closure accesses private property in child class
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit_buffer_size=1M
8opcache.protect_memory=1
9opcache.jit=tracing
10opcache.jit_hot_loop=1
11opcache.jit_hot_func=1
12opcache.jit_hot_return=1
13opcache.jit_hot_side_exit=1
14--EXTENSIONS--
15opcache
16--FILE--
17<?php
18
19abstract class a
20{
21    private int $v = 1;
22
23    public function test(): void
24    {
25        var_dump($this->v);
26        (function (): void {
27            var_dump($this->v);
28        })();
29    }
30}
31
32final class b extends a {
33    private int $v = 0;
34}
35$a = new b;
36
37for ($i = 0; $i < 10; $i++) {
38    $a->test();
39}
40
41?>
42--EXPECT--
43int(1)
44int(1)
45int(1)
46int(1)
47int(1)
48int(1)
49int(1)
50int(1)
51int(1)
52int(1)
53int(1)
54int(1)
55int(1)
56int(1)
57int(1)
58int(1)
59int(1)
60int(1)
61int(1)
62int(1)
63