Skip to content

Commit e465218

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fixed type inference for FETCH_DIM_W without use
2 parents 2b5007d + 22a171a commit e465218

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3385,6 +3385,10 @@ static zend_always_inline zend_result _zend_update_type_info(
33853385
|| opline->opcode == ZEND_FETCH_DIM_FUNC_ARG
33863386
|| opline->opcode == ZEND_FETCH_LIST_W) {
33873387
j = ssa_vars[ssa_op->result_def].use_chain;
3388+
if (j < 0) {
3389+
/* no uses */
3390+
tmp |= key_type | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_NULL;
3391+
}
33883392
while (j >= 0) {
33893393
zend_uchar opcode;
33903394

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
JIT FETCH_DIM_W: 002
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+
$b = [&$a[0]];
12+
}
13+
test();
14+
?>
15+
DONE
16+
--EXPECT--
17+
DONE

0 commit comments

Comments
 (0)