Skip to content

Commit 95befc7

Browse files
committedAug 22, 2022
Fix type inference
Fixes oss-fuzz #50272
1 parent 2a33280 commit 95befc7

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
 

‎Zend/Optimizer/zend_inference.c

+3
Original file line numberDiff line numberDiff line change
@@ -1951,6 +1951,9 @@ static uint32_t assign_dim_array_result_type(
19511951
tmp |= MAY_BE_ARRAY_KEY_STRING;
19521952
if (dim_op_type != IS_CONST) {
19531953
// FIXME: numeric string
1954+
if (arr_type & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
1955+
tmp |= MAY_BE_ARRAY_PACKED;
1956+
}
19541957
tmp |= MAY_BE_HASH_ONLY(arr_type) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG;
19551958
}
19561959
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Type inference 015: ASSIGN_DIM_OP
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--FILE--
8+
<?php
9+
function test() {
10+
for(;;) {
11+
$x[y.y] &= y;
12+
$x = false;
13+
$x[""] = y;
14+
}
15+
}
16+
?>
17+
DONE
18+
--EXPECT--
19+
DONE

0 commit comments

Comments
 (0)