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