Skip to content

Commit 4bccf36

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Save register before throwing undef var notice
2 parents be2500f + e22fb46 commit 4bccf36

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6427,6 +6427,9 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
64276427
| CMP_ZVAL_TYPE op1_addr, IS_NULL
64286428
| jg >7
64296429
}
6430+
if (Z_REG(op1_addr) != ZREG_FP) {
6431+
| mov T1, Ra(Z_REG(op1_addr)) // save
6432+
}
64306433
if (op1_info & MAY_BE_UNDEF) {
64316434
if (op1_info & MAY_BE_NULL) {
64326435
| IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
@@ -6437,9 +6440,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
64376440
|1:
64386441
}
64396442
| // ZVAL_ARR(container, zend_new_array(8));
6440-
if (Z_REG(op1_addr) != ZREG_FP) {
6441-
| mov T1, Ra(Z_REG(op1_addr)) // save
6442-
}
64436443
| EXT_CALL _zend_new_array_0, r0
64446444
if (Z_REG(op1_addr) != ZREG_FP) {
64456445
| mov Ra(Z_REG(op1_addr)), T1 // restore
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
JIT ASSIGN_DIM_OP: Undefined variable
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--EXTENSIONS--
9+
opcache
10+
--FILE--
11+
<?php
12+
$a[] &= 1;
13+
?>
14+
--EXPECTF--
15+
Warning: Undefined variable $a in %s on line %d

0 commit comments

Comments
 (0)