Fixed empty array inference

This commit is contained in:
Dmitry Stogov 2023-11-08 22:03:42 +03:00
parent 0734a12591
commit 5a77870492

View File

@ -2674,6 +2674,9 @@ static zend_always_inline zend_result _zend_update_type_info(
}
}
if (opline->extended_value == IS_ARRAY) {
if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL)) {
tmp |= MAY_BE_ARRAY_EMPTY;
}
if (t1 & MAY_BE_ARRAY) {
tmp |= t1 & (MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF);
}
@ -3387,6 +3390,9 @@ static zend_always_inline zend_result _zend_update_type_info(
arr_type = RES_USE_INFO();
}
tmp = MAY_BE_RC1|MAY_BE_ARRAY|arr_type;
if (opline->opcode == ZEND_INIT_ARRAY && opline->op1_type == IS_UNUSED) {
tmp |= MAY_BE_ARRAY_EMPTY;
}
if (opline->op1_type != IS_UNUSED
&& (opline->op2_type == IS_UNUSED
|| (t2 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_RESOURCE|MAY_BE_STRING)))) {