mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix trampoline leak in array_map
This commit is contained in:
parent
c8093fe94a
commit
e81becce08
3 changed files with 10 additions and 0 deletions
|
@ -420,6 +420,9 @@ void shutdown_executor(void) /* {{{ */
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Check whether anyone is hogging the trampoline. */
|
||||
ZEND_ASSERT(EG(trampoline).common.function_name == NULL || CG(unclean_shutdown));
|
||||
|
||||
EG(ht_iterators_used) = 0;
|
||||
|
||||
zend_shutdown_fpu();
|
||||
|
|
|
@ -6092,6 +6092,7 @@ PHP_FUNCTION(array_map)
|
|||
int ret;
|
||||
|
||||
if (Z_TYPE(arrays[0]) != IS_ARRAY) {
|
||||
zend_release_fcall_info_cache(&fci_cache);
|
||||
zend_argument_type_error(2, "must be of type array, %s given", zend_zval_type_name(&arrays[0]));
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,11 @@ $name = "foo" . ($x = "bar");
|
|||
$cb = [new Test, $name];
|
||||
array_map($cb, []);
|
||||
array_map($cb, [], []);
|
||||
try {
|
||||
array_map($cb, null);
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
array_filter([], $cb);
|
||||
array_reduce([], $cb);
|
||||
|
||||
|
@ -24,4 +29,5 @@ usort($array, $cb);
|
|||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
array_map(): Argument #2 ($array1) must be of type array, null given
|
||||
===DONE===
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue