gh8461-006.phpt 840 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Bug GH-8461 006 (JIT does not account for function re-compile)
  3. --EXTENSIONS--
  4. opcache
  5. --INI--
  6. opcache.enable=1
  7. opcache.enable_cli=1
  8. opcache.jit_buffer_size=1M
  9. opcache.jit=1255
  10. opcache.file_update_protection=0
  11. opcache.revalidate_freq=0
  12. opcache.protect_memory=1
  13. --FILE--
  14. <?php
  15. namespace {
  16. $x = 0;
  17. function test() {
  18. global $x;
  19. $x += 1;
  20. }
  21. }
  22. namespace test {
  23. if (!isset(opcache_get_status()['scripts'][__DIR__ . '/gh8461-006.inc'])) {
  24. $initialRequest = true;
  25. require __DIR__ . '/gh8461-006.inc';
  26. } else {
  27. $initialRequest = false;
  28. $y = 0;
  29. function test() {
  30. global $y;
  31. $y += 1;
  32. }
  33. }
  34. for ($i = 0; $i < 10; $i++) {
  35. test();
  36. }
  37. var_dump($initialRequest ? $x : $y);
  38. print "OK";
  39. }
  40. --EXPECT--
  41. int(10)
  42. OK