mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed Bug GH-8863: RW operation on readonly property doesn't throw with JIT
This commit is contained in:
parent
bf29ee6917
commit
ad40fffd36
2 changed files with 38 additions and 0 deletions
|
@ -2558,6 +2558,11 @@ static void ZEND_FASTCALL zend_jit_assign_op_to_typed_prop(zval *zptr, zend_prop
|
|||
zend_execute_data *execute_data = EG(current_execute_data);
|
||||
zval z_copy;
|
||||
|
||||
if (UNEXPECTED(prop_info->flags & ZEND_ACC_READONLY)) {
|
||||
zend_readonly_property_modification_error(prop_info);
|
||||
return;
|
||||
}
|
||||
|
||||
ZVAL_DEREF(zptr);
|
||||
/* Make sure that in-place concatenation is used if the LHS is a string. */
|
||||
if (binary_op == concat_function && Z_TYPE_P(zptr) == IS_STRING) {
|
||||
|
|
33
ext/opcache/tests/jit/gh8863.phpt
Normal file
33
ext/opcache/tests/jit/gh8863.phpt
Normal file
|
@ -0,0 +1,33 @@
|
|||
--TEST--
|
||||
Bug GH-8863: RW operation on readonly property doesn't throw with JIT
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.jit_buffer_size=1M
|
||||
--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";
|
||||
}
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
Cannot modify readonly property Test::$prop
|
||||
DONE
|
Loading…
Add table
Add a link
Reference in a new issue