Closed
Description
Description
The following code:
--TEST--
Readonly RW doesn't throw with JIT
--FILE--
<?php
class Test {
public readonly int $prop;
public function __construct() {
$this->prop = 1;
}
public function rw() {
$this->prop += 1;
echo "Done\n";
}
}
$test = new Test();
try {
$test->rw();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Cannot modify readonly property Test::$prop
Resulted in this output:
Done
But I expected this output instead:
Cannot modify readonly property Test::$prop
Discovered in #8188.
PHP Version
PHP 8.1.7
Operating System
Fedora 36