xref: /PHP-8.4/ext/opcache/tests/jit/gh8591-003.phpt (revision c16ad918)
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=1255
9opcache.file_update_protection=0
10opcache.revalidate_freq=0
11opcache.protect_memory=1
12--FILE--
13<?php
14
15interface ModelInterface
16{
17}
18
19class Model implements ModelInterface
20{
21    protected static int $field = 1;
22
23    public function __construct()
24    {
25        for ($i = 0; $i < 10; $i++) {
26            $this->cast();
27        }
28    }
29
30    private function cast()
31    {
32        global $x;
33        $x = static::$field;
34    }
35}
36
37new Model();
38
39var_dump($x);
40
41print "OK";
42?>
43--EXPECT--
44int(1)
45OK
46