Skip to content

Commit

Permalink
Merge branch 'PHP-8.3'
Browse files Browse the repository at this point in the history
* PHP-8.3:
  Fixed empty array inference
  • Loading branch information
dstogov committed Nov 8, 2023
2 parents 524b134 + 9717e9f commit fc66f37
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Zend/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)))) {
Expand Down

0 comments on commit fc66f37

Please sign in to comment.