From: Nikita Popov Date: Thu, 30 Jul 2020 15:14:34 +0000 (+0200) Subject: Add type inference support for RECV_VARIADIC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9dacc8525170664790c72967329dbc4d22a4e6f0;p=php Add type inference support for RECV_VARIADIC --- diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 669c88cc7a..1ca381d968 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2996,6 +2996,7 @@ static zend_always_inline int _zend_update_type_info( break; case ZEND_RECV: case ZEND_RECV_INIT: + case ZEND_RECV_VARIADIC: { /* Typehinting */ 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( tmp |= MAY_BE_REF; } + if (opline->opcode == ZEND_RECV_VARIADIC) { + uint32_t elem_type = tmp & MAY_BE_REF + ? MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF + : (tmp & MAY_BE_ANY) << MAY_BE_ARRAY_SHIFT; + tmp = MAY_BE_RC1|MAY_BE_RCN|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|elem_type; + ce = NULL; + } + UPDATE_SSA_TYPE(tmp, ssa_op->result_def); if (ce) { UPDATE_SSA_OBJ_TYPE(ce, 1, ssa_op->result_def);