Fix fake closure leaking when called from internal func

Introduced in 8e49d7f32f.

ZEND_CALL_RELEASE_THIS was previously not handled for internal calls but
just for user calls in the zend_leave_helper.

Closes GH-9884
This commit is contained in:
Ilija Tovilo 2022-11-03 13:20:30 +01:00
parent fdd088fc81
commit cc9dddea38
No known key found for this signature in database
GPG key ID: A4F5D403F118200A
2 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,15 @@
--TEST--
Fake closure called from internal function leaks
--FILE--
<?php
$c = \is_array(...);
var_dump(array_filter([[]], $c));
?>
--EXPECT--
array(1) {
[0]=>
array(0) {
}
}

View file

@ -973,6 +973,10 @@ cleanup_args:
zend_interrupt_function(EG(current_execute_data)); zend_interrupt_function(EG(current_execute_data));
} }
} }
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
OBJ_RELEASE(Z_OBJ(call->This));
}
} }
EG(fake_scope) = orig_fake_scope; EG(fake_scope) = orig_fake_scope;