mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
There's no need to actually try to trigger an out-of-memory condition to proof the leak; instead we can simply rely on the Zend MM to report the memory leaks in debug mode (at least on Linux). Therefore we simplify the regression test, which also makes it run much faster.
19 lines
298 B
PHP
19 lines
298 B
PHP
--TEST--
|
|
Bug #76778 (array_reduce leaks memory if callback throws exception)
|
|
--FILE--
|
|
<?php
|
|
try {
|
|
array_reduce(
|
|
[1],
|
|
function ($carry, $item) {
|
|
throw new Exception;
|
|
},
|
|
range(1, 3)
|
|
);
|
|
} catch (Exception $e) {
|
|
}
|
|
?>
|
|
===DONE===
|
|
--EXPECT--
|
|
===DONE===
|