Skip to content

Commit 52dac3e

Browse files
committed
Fixed bug #65382 (Segfault in closure_030.phpt)
1 parent 3ada3aa commit 52dac3e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2684,7 +2684,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
26842684
if (call->object) {
26852685
Z_ADDREF_P(call->object);
26862686
}
2687-
if (OP2_TYPE == IS_VAR && OP2_FREE &&
2687+
if (OP2_TYPE == IS_VAR && OP2_FREE && Z_REFCOUNT_P(function_name) == 1 &&
26882688
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
26892689
/* Delay closure destruction until its invocation */
26902690
call->fbc->common.prototype = (zend_function*)function_name;

Zend/zend_vm_execute.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
12671267
if (call->object) {
12681268
Z_ADDREF_P(call->object);
12691269
}
1270-
if (IS_CONST == IS_VAR && 0 &&
1270+
if (IS_CONST == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 &&
12711271
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
12721272
/* Delay closure destruction until its invocation */
12731273
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
15921592
if (call->object) {
15931593
Z_ADDREF_P(call->object);
15941594
}
1595-
if (IS_TMP_VAR == IS_VAR && 1 &&
1595+
if (IS_TMP_VAR == IS_VAR && 1 && Z_REFCOUNT_P(function_name) == 1 &&
15961596
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
15971597
/* Delay closure destruction until its invocation */
15981598
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
17791779
if (call->object) {
17801780
Z_ADDREF_P(call->object);
17811781
}
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 &&
17831783
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
17841784
/* Delay closure destruction until its invocation */
17851785
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
20042004
if (call->object) {
20052005
Z_ADDREF_P(call->object);
20062006
}
2007-
if (IS_CV == IS_VAR && 0 &&
2007+
if (IS_CV == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 &&
20082008
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
20092009
/* Delay closure destruction until its invocation */
20102010
call->fbc->common.prototype = (zend_function*)function_name;

0 commit comments

Comments
 (0)