Skip to content

Commit 1335ebd

Browse files
committed
Fix Closure leak in aborted INIT_DYNAMIC_FCALL
1 parent bc0df38 commit 1335ebd

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--FILE--
2+
Closure must not leak during a dynmaic call interrupted by an exception
3+
--TEST--
4+
<?php
5+
6+
(function() {
7+
$closure = function($foo) { var_dump($foo); };
8+
$closure(yield);
9+
})()->valid(); // start
10+
11+
?>
12+
==DONE==
13+
--EXPECT--
14+
==DONE==

Zend/zend_execute.c

+3
Original file line numberDiff line numberDiff line change
@@ -2486,6 +2486,9 @@ static zend_always_inline void i_cleanup_unfinished_execution(zend_execute_data
24862486
}
24872487
OBJ_RELEASE(Z_OBJ(call->This));
24882488
}
2489+
if (call->func->common.fn_flags & ZEND_ACC_CLOSURE) {
2490+
zend_object_release(call->func->common.prototype);
2491+
}
24892492
if (call->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
24902493
zend_string_release(call->func->common.function_name);
24912494
zend_free_trampoline(call->func);

0 commit comments

Comments
 (0)