xref: /PHP-8.2/ext/opcache/tests/jit/gh8591-003.phpt (revision 69d263e2)
1--TEST--
2Bug GH-8591 003 (JIT does not account for class re-compile)
3--EXTENSIONS--
4opcache
5--INI--
6opcache.enable=1
7opcache.enable_cli=1
8opcache.jit_buffer_size=1M
9opcache.jit=1255
10opcache.file_update_protection=0
11opcache.revalidate_freq=0
12opcache.protect_memory=1
13--FILE--
14<?php
15
16interface ModelInterface
17{
18}
19
20class Model implements ModelInterface
21{
22    protected static int $field = 1;
23
24    public function __construct()
25    {
26        for ($i = 0; $i < 10; $i++) {
27            $this->cast();
28        }
29    }
30
31    private function cast()
32    {
33        global $x;
34        $x = static::$field;
35    }
36}
37
38new Model();
39
40var_dump($x);
41
42print "OK";
43--EXPECT--
44int(1)
45OK
46