Skip to content

Commit e81becc

Browse files
committed
Fix trampoline leak in array_map
1 parent c8093fe commit e81becc

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Zend/zend_execute_API.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,9 @@ void shutdown_executor(void) /* {{{ */
420420
}
421421
#endif
422422

423+
/* Check whether anyone is hogging the trampoline. */
424+
ZEND_ASSERT(EG(trampoline).common.function_name == NULL || CG(unclean_shutdown));
425+
423426
EG(ht_iterators_used) = 0;
424427

425428
zend_shutdown_fpu();

ext/standard/array.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6092,6 +6092,7 @@ PHP_FUNCTION(array_map)
60926092
int ret;
60936093

60946094
if (Z_TYPE(arrays[0]) != IS_ARRAY) {
6095+
zend_release_fcall_info_cache(&fci_cache);
60956096
zend_argument_type_error(2, "must be of type array, %s given", zend_zval_type_name(&arrays[0]));
60966097
RETURN_THROWS();
60976098
}

ext/standard/tests/array/bug74345.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ $name = "foo" . ($x = "bar");
1313
$cb = [new Test, $name];
1414
array_map($cb, []);
1515
array_map($cb, [], []);
16+
try {
17+
array_map($cb, null);
18+
} catch (Error $e) {
19+
echo $e->getMessage(), "\n";
20+
}
1621
array_filter([], $cb);
1722
array_reduce([], $cb);
1823

@@ -24,4 +29,5 @@ usort($array, $cb);
2429
?>
2530
===DONE===
2631
--EXPECT--
32+
array_map(): Argument #2 ($array1) must be of type array, null given
2733
===DONE===

0 commit comments

Comments
 (0)