gh8461-004.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. --TEST--
  2. Bug GH-8461 004 (JIT does not account for class 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. // Checks that JITed code does not crash in --repeat 2 after the UniqueList
  16. // class changes.
  17. if (!isset(opcache_get_status()['scripts'][__DIR__ . '/gh8461-004.inc'])) {
  18. $initialRequest = true;
  19. require __DIR__ . '/gh8461-004.inc';
  20. } else {
  21. $initialRequest = false;
  22. $y = 0;
  23. class UniqueList
  24. {
  25. public const A = 1;
  26. public const B = 1;
  27. private $foo;
  28. public function __construct($b)
  29. {
  30. global $y;
  31. $y++;
  32. $this->foo = self::A + $b;
  33. }
  34. }
  35. }
  36. class UniqueListLast extends UniqueList
  37. {
  38. public function __construct()
  39. {
  40. parent::__construct(self::B);
  41. }
  42. }
  43. for ($i = 0; $i < 10; $i++) {
  44. new UniqueListLast();
  45. }
  46. var_dump($initialRequest ? $x : $y);
  47. print "OK";
  48. --EXPECT--
  49. int(10)
  50. OK