mirror of
https://github.com/php/php-src.git
synced 2026-04-28 02:33:17 +02:00
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix missing readonly modification error with inc/dec in JIT
This commit is contained in:
@@ -62,6 +62,8 @@ PHP NEWS
|
||||
|
||||
- Opcache:
|
||||
. Fix incorrect page_size check. (nielsdos)
|
||||
. Fix readonly modification check when using inc/dec operators on readonly
|
||||
property with JIT. (ilutov)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed php_openssl_set_server_dh_param() DH params errors handling. (nielsdos)
|
||||
|
||||
@@ -2650,6 +2650,13 @@ static ZEND_COLD zend_long _zend_jit_throw_dec_prop_error(zend_property_info *pr
|
||||
|
||||
static void ZEND_FASTCALL zend_jit_inc_typed_prop(zval *var_ptr, zend_property_info *prop_info)
|
||||
{
|
||||
ZEND_ASSERT(Z_TYPE_P(var_ptr) != IS_UNDEF);
|
||||
|
||||
if (UNEXPECTED((prop_info->flags & ZEND_ACC_READONLY))) {
|
||||
zend_readonly_property_modification_error(prop_info);
|
||||
return;
|
||||
}
|
||||
|
||||
zend_execute_data *execute_data = EG(current_execute_data);
|
||||
zval tmp;
|
||||
|
||||
@@ -2673,6 +2680,13 @@ static void ZEND_FASTCALL zend_jit_inc_typed_prop(zval *var_ptr, zend_property_i
|
||||
|
||||
static void ZEND_FASTCALL zend_jit_dec_typed_prop(zval *var_ptr, zend_property_info *prop_info)
|
||||
{
|
||||
ZEND_ASSERT(Z_TYPE_P(var_ptr) != IS_UNDEF);
|
||||
|
||||
if (UNEXPECTED((prop_info->flags & ZEND_ACC_READONLY))) {
|
||||
zend_readonly_property_modification_error(prop_info);
|
||||
return;
|
||||
}
|
||||
|
||||
zend_execute_data *execute_data = EG(current_execute_data);
|
||||
zval tmp;
|
||||
|
||||
@@ -2710,6 +2724,16 @@ static void ZEND_FASTCALL zend_jit_pre_dec_typed_prop(zval *var_ptr, zend_proper
|
||||
|
||||
static void ZEND_FASTCALL zend_jit_post_inc_typed_prop(zval *var_ptr, zend_property_info *prop_info, zval *result)
|
||||
{
|
||||
ZEND_ASSERT(Z_TYPE_P(var_ptr) != IS_UNDEF);
|
||||
|
||||
if (UNEXPECTED((prop_info->flags & ZEND_ACC_READONLY))) {
|
||||
zend_readonly_property_modification_error(prop_info);
|
||||
if (result) {
|
||||
ZVAL_UNDEF(result);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
zend_execute_data *execute_data = EG(current_execute_data);
|
||||
|
||||
ZVAL_DEREF(var_ptr);
|
||||
@@ -2731,6 +2755,16 @@ static void ZEND_FASTCALL zend_jit_post_inc_typed_prop(zval *var_ptr, zend_prope
|
||||
|
||||
static void ZEND_FASTCALL zend_jit_post_dec_typed_prop(zval *var_ptr, zend_property_info *prop_info, zval *result)
|
||||
{
|
||||
ZEND_ASSERT(Z_TYPE_P(var_ptr) != IS_UNDEF);
|
||||
|
||||
if (UNEXPECTED((prop_info->flags & ZEND_ACC_READONLY))) {
|
||||
zend_readonly_property_modification_error(prop_info);
|
||||
if (result) {
|
||||
ZVAL_UNDEF(result);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
zend_execute_data *execute_data = EG(current_execute_data);
|
||||
|
||||
ZVAL_DEREF(var_ptr);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
JIT readonly modification post-inc
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
public readonly int $bar;
|
||||
|
||||
public function __construct() {
|
||||
$this->bar = 1;
|
||||
$this->bar++;
|
||||
}
|
||||
}
|
||||
|
||||
new Foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot modify readonly property Foo::$bar in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): Foo->__construct()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
JIT readonly modification pre-inc
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
public readonly int $bar;
|
||||
|
||||
public function __construct() {
|
||||
$this->bar = 1;
|
||||
++$this->bar;
|
||||
}
|
||||
}
|
||||
|
||||
new Foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot modify readonly property Foo::$bar in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): Foo->__construct()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
JIT readonly modification post-inc with result
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
public readonly int $bar;
|
||||
|
||||
public function __construct() {
|
||||
$this->bar = 1;
|
||||
var_dump($this->bar++);
|
||||
}
|
||||
}
|
||||
|
||||
new Foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot modify readonly property Foo::$bar in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): Foo->__construct()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
JIT readonly modification pre-inc with result
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
public readonly int $bar;
|
||||
|
||||
public function __construct() {
|
||||
$this->bar = 1;
|
||||
var_dump(++$this->bar);
|
||||
}
|
||||
}
|
||||
|
||||
new Foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot modify readonly property Foo::$bar in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): Foo->__construct()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
JIT readonly modification post-dec
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
public readonly int $bar;
|
||||
|
||||
public function __construct() {
|
||||
$this->bar = 1;
|
||||
$this->bar--;
|
||||
}
|
||||
}
|
||||
|
||||
new Foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot modify readonly property Foo::$bar in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): Foo->__construct()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
JIT readonly modification pre-dec
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
public readonly int $bar;
|
||||
|
||||
public function __construct() {
|
||||
$this->bar = 1;
|
||||
--$this->bar;
|
||||
}
|
||||
}
|
||||
|
||||
new Foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot modify readonly property Foo::$bar in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): Foo->__construct()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
JIT readonly modification dec-inc with result
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
public readonly int $bar;
|
||||
|
||||
public function __construct() {
|
||||
$this->bar = 1;
|
||||
var_dump($this->bar--);
|
||||
}
|
||||
}
|
||||
|
||||
new Foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot modify readonly property Foo::$bar in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): Foo->__construct()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
JIT readonly modification pre-dec with result
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
public readonly int $bar;
|
||||
|
||||
public function __construct() {
|
||||
$this->bar = 1;
|
||||
var_dump(--$this->bar);
|
||||
}
|
||||
}
|
||||
|
||||
new Foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot modify readonly property Foo::$bar in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): Foo->__construct()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
Reference in New Issue
Block a user