Fix type inference

This fixes oss-fuzz #47920
This commit is contained in:
Dmitry Stogov 2022-06-14 10:20:45 +03:00
parent 4b8bbfb6db
commit 1b45efb6fb
2 changed files with 19 additions and 1 deletions

View file

@ -3227,7 +3227,7 @@ static zend_always_inline int _zend_update_type_info(
tmp |= t1 & (MAY_BE_RC1|MAY_BE_RCN);
}
if (opline->op2_type == IS_UNUSED) {
if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL)) {
if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
key_type |= MAY_BE_ARRAY_PACKED;
}
if (t1 & MAY_BE_ARRAY) {

View file

@ -0,0 +1,18 @@
--TEST--
Type inference 010: FRTCH_DIM_W
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--FILE--
<?php
function foo() {
$x = false;
$x[] = &$y;
}
foo();
?>
DONE
--EXPECTF--
Deprecated: Automatic conversion of false to array is deprecated in %sinference_010.php on line 4
DONE