Skip to content

Commit a9231e7

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Fix fake closure leaking when called from internal func
2 parents 28dd600 + cc9ddde commit a9231e7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Fake closure called from internal function leaks
3+
--FILE--
4+
<?php
5+
6+
$c = \is_array(...);
7+
var_dump(array_filter([[]], $c));
8+
9+
?>
10+
--EXPECT--
11+
array(1) {
12+
[0]=>
13+
array(0) {
14+
}
15+
}

Zend/zend_execute_API.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,10 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
973973
zend_interrupt_function(EG(current_execute_data));
974974
}
975975
}
976+
977+
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
978+
OBJ_RELEASE(Z_OBJ(call->This));
979+
}
976980
}
977981
EG(fake_scope) = orig_fake_scope;
978982

0 commit comments

Comments
 (0)