1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 05:21:02 +02:00

Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  JIT: Fix ASSIGN_DIM_OP with undefined variable and index and user error handler, throwing an exception
This commit is contained in:
Dmitry Stogov
2021-12-02 22:24:06 +03:00
2 changed files with 35 additions and 0 deletions

View File

@@ -587,6 +587,9 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *di
case IS_UNDEF:
execute_data = EG(current_execute_data);
opline = EX(opline);
if (UNEXPECTED(opline->opcode == ZEND_HANDLE_EXCEPTION)) {
opline = EG(opline_before_exception);
}
if (!zend_jit_undefined_op_helper_write(ht, opline->op2.var)) {
if (opline->result_type & (IS_VAR | IS_TMP_VAR)) {
if (EG(exception)) {

View File

@@ -0,0 +1,32 @@
--TEST--
JIT ASSIGN_DIM_OP: Undefined variable and index with exception
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
set_error_handler(function($_, $m){
throw new Exception($m);
});
function test1() {
$res = $a[$undef] = null;
}
function test2() {
$res = $a[$undef] += 1;
}
try {
test1();
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
try {
test2();
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Undefined variable $undef
Undefined variable $a