xref: /PHP-8.1/ext/opcache/tests/jit/gh8461-005.phpt (revision 6c254131)
1--TEST--
2Bug GH-8461 005 (JIT does not account for function 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
16if (!isset(opcache_get_status()['scripts'][__DIR__ . '/gh8461-005.inc'])) {
17    $initialRequest = true;
18    require __DIR__ . '/gh8461-005.inc';
19
20} else {
21    $initialRequest = false;
22    $y = 0;
23    function test() {
24        global $y;
25        $y += 1;
26    }
27}
28
29for ($i = 0; $i < 10; $i++) {
30    test();
31}
32
33var_dump($initialRequest ? $x : $y);
34print "OK";
35--EXPECT--
36int(10)
37OK
38