gh8461-008.phpt 1018 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. --TEST--
  2. Bug GH-8461 008 (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. $x = 0;
  16. class UniqueList
  17. {
  18. const A = 1;
  19. const B = 1;
  20. private $foo;
  21. public function __construct($b)
  22. {
  23. global $x;
  24. $x++;
  25. $this->foo = self::A + $b;
  26. }
  27. public static function foo()
  28. {
  29. global $x;
  30. $x += self::A;
  31. }
  32. }
  33. class UniqueListLast extends UniqueList
  34. {
  35. public function __construct()
  36. {
  37. parent::__construct(self::B);
  38. }
  39. public static function bar() {
  40. parent::foo();
  41. }
  42. }
  43. function test() {
  44. global $x;
  45. $x += 1;
  46. }
  47. for ($i = 0; $i < 100; $i++) {
  48. UniqueListLast::bar();
  49. }
  50. for ($i = 0; $i < 100; $i++) {
  51. new UniqueListLast();
  52. }
  53. for ($i = 0; $i < 10; $i++) {
  54. test();
  55. }
  56. print "OK";
  57. --EXPECT--
  58. OK