Skip to content

Commit 82d3ad6

Browse files
committed
Fix type inference
Fixes oss-fuzz #48908
1 parent 4b38779 commit 82d3ad6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,6 +1936,9 @@ static uint32_t assign_dim_array_result_type(
19361936
value_type |= MAY_BE_NULL;
19371937
}
19381938
if (dim_op_type == IS_UNUSED) {
1939+
if (arr_type & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
1940+
tmp |= MAY_BE_ARRAY_PACKED;
1941+
}
19391942
tmp |= MAY_BE_HASH_ONLY(arr_type) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG;
19401943
} else {
19411944
if (dim_type & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Type inference 013: ASSIGN_DIM
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--FILE--
8+
<?php
9+
function y(){
10+
for(;;){
11+
$x[] &= y;
12+
$x = false;
13+
$x[""] = y;
14+
}
15+
}
16+
?>
17+
DONE
18+
--EXPECT--
19+
DONE

0 commit comments

Comments
 (0)