xref: /php-src/ext/opcache/tests/jit/gh8461-008.phpt (revision c16ad918)
1--TEST--
2Bug GH-8461 008 (JIT does not account for function 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
15$x = 0;
16
17class UniqueList
18{
19    const A = 1;
20    const B = 1;
21
22    private $foo;
23
24    public function __construct($b)
25    {
26        global $x;
27        $x++;
28
29        $this->foo = self::A + $b;
30    }
31
32    public static function foo()
33    {
34        global $x;
35        $x += self::A;
36    }
37}
38
39class UniqueListLast extends UniqueList
40{
41    public function __construct()
42    {
43        parent::__construct(self::B);
44    }
45
46    public static function bar() {
47        parent::foo();
48    }
49}
50
51function test() {
52        global $x;
53        $x += 1;
54}
55
56for ($i = 0; $i < 100; $i++) {
57    UniqueListLast::bar();
58}
59
60for ($i = 0; $i < 100; $i++) {
61    new UniqueListLast();
62}
63
64for ($i = 0; $i < 10; $i++) {
65    test();
66}
67
68print "OK";
69?>
70--EXPECT--
71OK
72