Skip to content

Commit bf515be

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: JIT: Fix missed type store
2 parents 55f1db6 + 0d6b173 commit bf515be

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3306,6 +3306,9 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
33063306
op2_def_addr = op2_addr;
33073307
}
33083308
op1_info = OP1_INFO();
3309+
if (ra && ssa->vars[ssa_op->op1_use].no_val) {
3310+
op1_info |= MAY_BE_UNDEF; // requres type assignment
3311+
}
33093312
if (opline->result_type == IS_UNUSED) {
33103313
res_addr = 0;
33113314
res_info = -1;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Register Alloction 009: Missing type store
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
function test() {
11+
for(;; $a + $y[4][] = $y < $a + $a = $b = $a = + $y[] = 0.1) {
12+
4 >> - $j++;
13+
}
14+
}
15+
test();
16+
?>
17+
--EXPECTF--
18+
Warning: Undefined variable $j in %sreg_alloc_009.php on line 4
19+
20+
Fatal error: Uncaught ArithmeticError: Bit shift by negative number in %sreg_alloc_009.php:4
21+
Stack trace:
22+
#0 %sreg_alloc_009.php(7): test()
23+
#1 {main}
24+
thrown in %sreg_alloc_009.php on line 4

0 commit comments

Comments
 (0)