Skip to content

Commit 9dacc85

Browse files
committed
Add type inference support for RECV_VARIADIC
1 parent 104b7ad commit 9dacc85

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2996,6 +2996,7 @@ static zend_always_inline int _zend_update_type_info(
29962996
break;
29972997
case ZEND_RECV:
29982998
case ZEND_RECV_INIT:
2999+
case ZEND_RECV_VARIADIC:
29993000
{
30003001
/* Typehinting */
30013002
zend_arg_info *arg_info = &op_array->arg_info[opline->op1.num-1];
@@ -3006,6 +3007,14 @@ static zend_always_inline int _zend_update_type_info(
30063007
tmp |= MAY_BE_REF;
30073008
}
30083009

3010+
if (opline->opcode == ZEND_RECV_VARIADIC) {
3011+
uint32_t elem_type = tmp & MAY_BE_REF
3012+
? MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF
3013+
: (tmp & MAY_BE_ANY) << MAY_BE_ARRAY_SHIFT;
3014+
tmp = MAY_BE_RC1|MAY_BE_RCN|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|elem_type;
3015+
ce = NULL;
3016+
}
3017+
30093018
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
30103019
if (ce) {
30113020
UPDATE_SSA_OBJ_TYPE(ce, 1, ssa_op->result_def);

0 commit comments

Comments
 (0)