Skip to content

Commit 1e55c97

Browse files
committed
Fixed type inference
Fixes oss-fuzz #64577, #64579, #64589
1 parent 9a69bb2 commit 1e55c97

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3673,7 +3673,8 @@ static zend_always_inline zend_result _zend_update_type_info(
36733673
tmp &= ~MAY_BE_ARRAY_EMPTY;
36743674
}
36753675
}
3676-
if (((tmp & MAY_BE_ARRAY) && (tmp & MAY_BE_ARRAY_KEY_ANY))
3676+
if (!(tmp & MAY_BE_ARRAY)
3677+
|| (tmp & MAY_BE_ARRAY_KEY_ANY)
36773678
|| opline->opcode == ZEND_FETCH_DIM_FUNC_ARG
36783679
|| opline->opcode == ZEND_FETCH_DIM_R
36793680
|| opline->opcode == ZEND_FETCH_DIM_IS
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Type inference 024: FETCH_DIM_W
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--FILE--
8+
<?php
9+
function foo() {
10+
for ($cnt = 0; $cnt < 6; $cnt++) {
11+
$b = new SplFixedArray(1);
12+
$b[0] = $a;
13+
$g = &$b[0];
14+
$b = new SplFixedArray(1);
15+
$b[0] = $b;
16+
$g = &$b[0];
17+
}
18+
}
19+
@foo();
20+
?>
21+
DONE
22+
--EXPECT--
23+
DONE

0 commit comments

Comments
 (0)