From: Nikita Popov Date: Fri, 10 Jul 2020 13:58:04 +0000 (+0200) Subject: Add missing addref for MATCH_ERROR operand X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5fc70243d77d785f08eda4588f2b2a539fa37d18;p=php Add missing addref for MATCH_ERROR operand --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b2a33068f5..1e2dfb5a4d 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5368,7 +5368,10 @@ void zend_compile_match(znode *result, zend_ast *ast) opline->extended_value = get_next_op_number(); } - zend_emit_op(NULL, ZEND_MATCH_ERROR, &expr_node, NULL); + zend_op *opline = zend_emit_op(NULL, ZEND_MATCH_ERROR, &expr_node, NULL); + if (opline->op1_type == IS_CONST) { + Z_TRY_ADDREF_P(CT_CONSTANT(opline->op1)); + } } for (uint32_t i = 0; i < arms->children; ++i) {