Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  Fixed empty array inference
This commit is contained in:
Dmitry Stogov 2023-11-08 22:04:09 +03:00
commit 9717e9fd56

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);
}
@ -3394,6 +3397,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)))) {