xref: /php-src/ext/opcache/tests/jit/gh12380.phpt (revision c16ad918)
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.protect_memory=1
8opcache.jit=tracing
9opcache.jit_hot_loop=1
10opcache.jit_hot_func=1
11opcache.jit_hot_return=1
12opcache.jit_hot_side_exit=1
13--EXTENSIONS--
14opcache
15--FILE--
16<?php
17
18abstract class a
19{
20    private int $v = 1;
21
22    public function test(): void
23    {
24        var_dump($this->v);
25        (function (): void {
26            var_dump($this->v);
27        })();
28    }
29}
30
31final class b extends a {
32    private int $v = 0;
33}
34$a = new b;
35
36for ($i = 0; $i < 10; $i++) {
37    $a->test();
38}
39
40?>
41--EXPECT--
42int(1)
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)
62