gh8863.phpt 565 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Bug GH-8863: RW operation on readonly property doesn't throw with JIT
  3. --INI--
  4. opcache.enable=1
  5. opcache.enable_cli=1
  6. opcache.file_update_protection=0
  7. opcache.jit_buffer_size=1M
  8. --FILE--
  9. <?php
  10. class Test {
  11. public readonly int $prop;
  12. public function __construct() {
  13. $this->prop = 1;
  14. }
  15. public function rw() {
  16. $this->prop += 1;
  17. echo "Done\n";
  18. }
  19. }
  20. $test = new Test();
  21. try {
  22. $test->rw();
  23. } catch (Error $e) {
  24. echo $e->getMessage(), "\n";
  25. }
  26. ?>
  27. DONE
  28. --EXPECT--
  29. Cannot modify readonly property Test::$prop
  30. DONE