Skip to content

Commit d50875c

Browse files
committed
Fix type inference
Fixes oss-fuzz #49423 and #49474
1 parent e70d282 commit d50875c

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
@@ -1942,6 +1942,9 @@ static uint32_t assign_dim_array_result_type(
19421942
tmp |= MAY_BE_HASH_ONLY(arr_type) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG;
19431943
} else {
19441944
if (dim_type & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
1945+
if (arr_type & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
1946+
tmp |= MAY_BE_ARRAY_PACKED;
1947+
}
19451948
tmp |= MAY_BE_HASH_ONLY(arr_type) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG;
19461949
}
19471950
if (dim_type & MAY_BE_STRING) {
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Type inference 014: 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 y() {
10+
for(;;){
11+
$x[y] &= y;
12+
$x = false;
13+
$x[""]=y;
14+
}
15+
}
16+
?>
17+
DONE
18+
--EXPECT--
19+
DONE

0 commit comments

Comments
 (0)