bug79888.phpt 693 B

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