Skip to content

Commit 71e82b9

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Check exception after undef var notice
2 parents d5e4f8f + b564113 commit 71e82b9

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5461,6 +5461,7 @@ static int zend_jit_simple_assign(dasm_State **Dst,
54615461
ZEND_ASSERT(Z_MODE(val_addr) == IS_MEM_ZVAL && Z_REG(val_addr) == ZREG_FP);
54625462
| LOAD_32BIT_VAL FCARG1w, Z_OFFSET(val_addr)
54635463
| EXT_CALL zend_jit_undefined_op_helper, REG0
5464+
| cbz RETVALx, ->exception_handler_undef
54645465
if (save_r1) {
54655466
| ldr FCARG1x, T1 // restore
54665467
}

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5949,6 +5949,8 @@ static int zend_jit_simple_assign(dasm_State **Dst,
59495949
ZEND_ASSERT(Z_MODE(val_addr) == IS_MEM_ZVAL && Z_REG(val_addr) == ZREG_FP);
59505950
| mov FCARG1d, Z_OFFSET(val_addr)
59515951
| EXT_CALL zend_jit_undefined_op_helper, r0
5952+
| test r0, r0
5953+
| jz ->exception_handler_undef
59525954
if (save_r1) {
59535955
| mov FCARG1a, aword T1 // restore
59545956
}

ext/opcache/tests/jit/assign_043.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
JIT ASSIGN: Undef var notice promoted to exception
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
--FILE--
10+
<?php
11+
set_error_handler(function($_, $m) {
12+
throw new Exception($m);
13+
});
14+
try {
15+
$a = $b;
16+
NOT_REACHED;
17+
} catch (Exception $e) {
18+
echo $e->getMessage(), "\n";
19+
}
20+
?>
21+
--EXPECT--
22+
Undefined variable $b

0 commit comments

Comments
 (0)