Skip to content

Commit 66d93c6

Browse files
committed
Fixed type inference for FETCH_DIM_W without use
1 parent 5751536 commit 66d93c6

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3330,6 +3330,10 @@ static zend_always_inline int _zend_update_type_info(
33303330
|| opline->opcode == ZEND_FETCH_DIM_FUNC_ARG
33313331
|| opline->opcode == ZEND_FETCH_LIST_W) {
33323332
j = ssa_vars[ssa_op->result_def].use_chain;
3333+
if (j < 0) {
3334+
/* no uses */
3335+
tmp |= key_type | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_NULL;
3336+
}
33333337
while (j >= 0) {
33343338
zend_uchar opcode;
33353339

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)