gh8591-003.phpt 665 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. Bug GH-8591 003 (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. interface ModelInterface
  16. {
  17. }
  18. class Model implements ModelInterface
  19. {
  20. protected static int $field = 1;
  21. public function __construct()
  22. {
  23. for ($i = 0; $i < 10; $i++) {
  24. $this->cast();
  25. }
  26. }
  27. private function cast()
  28. {
  29. global $x;
  30. $x = static::$field;
  31. }
  32. }
  33. new Model();
  34. var_dump($x);
  35. print "OK";
  36. --EXPECT--
  37. int(1)
  38. OK