Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  Check exception after undef var notice
This commit is contained in:
Nikita Popov 2021-10-07 16:59:39 +02:00
commit 71e82b9de2
3 changed files with 25 additions and 0 deletions

View file

@ -5461,6 +5461,7 @@ static int zend_jit_simple_assign(dasm_State **Dst,
ZEND_ASSERT(Z_MODE(val_addr) == IS_MEM_ZVAL && Z_REG(val_addr) == ZREG_FP);
| LOAD_32BIT_VAL FCARG1w, Z_OFFSET(val_addr)
| EXT_CALL zend_jit_undefined_op_helper, REG0
| cbz RETVALx, ->exception_handler_undef
if (save_r1) {
| ldr FCARG1x, T1 // restore
}

View file

@ -5949,6 +5949,8 @@ static int zend_jit_simple_assign(dasm_State **Dst,
ZEND_ASSERT(Z_MODE(val_addr) == IS_MEM_ZVAL && Z_REG(val_addr) == ZREG_FP);
| mov FCARG1d, Z_OFFSET(val_addr)
| EXT_CALL zend_jit_undefined_op_helper, r0
| test r0, r0
| jz ->exception_handler_undef
if (save_r1) {
| mov FCARG1a, aword T1 // restore
}

View file

@ -0,0 +1,22 @@
--TEST--
JIT ASSIGN: Undef var notice promoted to exception
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
opcache.protect_memory=1
--FILE--
<?php
set_error_handler(function($_, $m) {
throw new Exception($m);
});
try {
$a = $b;
NOT_REACHED;
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Undefined variable $b