[php-src] Issue #8863: RW operation on readonly property doesn't throw with JIT

From: Date: Fri, 24 Jun 2022 17:45:31 +0000
Subject: [php-src] Issue #8863: RW operation on readonly property doesn't throw with JIT
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241803@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8863 Author: iluuu1994 ### Description The following code: ```php --TEST-- Readonly RW doesn't throw with JIT --FILE-- <?php class Test { public readonly int $prop; public function init() { $this->prop = 1; } public function rw() { $this->prop += 1; echo 'done'; } } $test = new Test(); $test->init(); try { $test->rw(); } catch (Error $e) { echo $e->getMessage(); } echo "\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 https://github.com/php/php-src/pull/8188. ### PHP Version PHP 8.1.7 ### Operating System Fedora 36

« previous php.bugs (#241803) next »