xref: /PHP-8.4/ext/opcache/tests/jit/bug79888.phpt (revision c16ad918)
1--TEST--
2Bug #79888 (Incorrect execution with JIT enabled)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit=1205
8--EXTENSIONS--
9opcache
10--FILE--
11<?php
12function testPrime(int $a): bool {
13    if ($a < 2)  {
14        return false;
15    } else if ($a == 2) {
16        return true;
17    }
18    for ($j = 2; $j < $a; $j++) {
19        if (($a % $j) == 0) {
20            return false;
21        }
22    }
23    return true;
24}
25
26$max = 1000;
27$cnt = 0;
28echo "Testing Primes until: " . $max . "\n";
29for ($i = 2; $i <= $max; $i++)
30{
31        if (testPrime($i)) $cnt++;
32}
33echo "Primect: {$cnt}\n";
34?>
35--EXPECT--
36Testing Primes until: 1000
37Primect: 168
38