@@ -1267,7 +1267,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
1267
1267
if (call->object) {
1268
1268
Z_ADDREF_P(call->object);
1269
1269
}
1270
- if (IS_CONST == IS_VAR && 0 &&
1270
+ if (IS_CONST == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 &&
1271
1271
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
1272
1272
/* Delay closure destruction until its invocation */
1273
1273
call->fbc->common.prototype = (zend_function*)function_name;
@@ -1592,7 +1592,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
1592
1592
if (call->object) {
1593
1593
Z_ADDREF_P(call->object);
1594
1594
}
1595
- if (IS_TMP_VAR == IS_VAR && 1 &&
1595
+ if (IS_TMP_VAR == IS_VAR && 1 && Z_REFCOUNT_P(function_name) == 1 &&
1596
1596
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
1597
1597
/* Delay closure destruction until its invocation */
1598
1598
call->fbc->common.prototype = (zend_function*)function_name;
@@ -1779,7 +1779,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
1779
1779
if (call->object) {
1780
1780
Z_ADDREF_P(call->object);
1781
1781
}
1782
- if (IS_VAR == IS_VAR && (free_op2.var != NULL) &&
1782
+ if (IS_VAR == IS_VAR && (free_op2.var != NULL) && Z_REFCOUNT_P(function_name) == 1 &&
1783
1783
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
1784
1784
/* Delay closure destruction until its invocation */
1785
1785
call->fbc->common.prototype = (zend_function*)function_name;
@@ -2004,7 +2004,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
2004
2004
if (call->object) {
2005
2005
Z_ADDREF_P(call->object);
2006
2006
}
2007
- if (IS_CV == IS_VAR && 0 &&
2007
+ if (IS_CV == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 &&
2008
2008
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
2009
2009
/* Delay closure destruction until its invocation */
2010
2010
call->fbc->common.prototype = (zend_function*)function_name;
0 commit comments