gh8591-004.phpt 869 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --TEST--
  2. Bug GH-8591 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 ModelTrait
  16. // trait is recompiled and Model is re-linked.
  17. require __DIR__ . '/gh8591-004.inc';
  18. class Model
  19. {
  20. use ModelTrait;
  21. protected static int $field = 1;
  22. public function __construct()
  23. {
  24. for ($i = 0; $i < 10; $i++) {
  25. $this->cast();
  26. }
  27. }
  28. private function cast()
  29. {
  30. global $x;
  31. $x = static::$field;
  32. }
  33. }
  34. new Model();
  35. // mark the file as changed (important)
  36. touch(__DIR__ . '/gh8591-004.inc');
  37. var_dump($x);
  38. print "OK";
  39. --EXPECT--
  40. int(1)
  41. OK