xref: /php-src/ext/opcache/tests/jit/gh8461-005.phpt (revision c16ad918)
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=1255
9opcache.file_update_protection=0
10opcache.revalidate_freq=0
11opcache.protect_memory=1
12--FILE--
13<?php
14
15if (!isset(opcache_get_status()['scripts'][__DIR__ . '/gh8461-005.inc'])) {
16    $initialRequest = true;
17    require __DIR__ . '/gh8461-005.inc';
18
19} else {
20    $initialRequest = false;
21    $y = 0;
22    function test() {
23        global $y;
24        $y += 1;
25    }
26}
27
28for ($i = 0; $i < 10; $i++) {
29    test();
30}
31
32var_dump($initialRequest ? $x : $y);
33print "OK";
34?>
35--EXPECT--
36int(10)
37OK
38