Simplify regression test

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.
This commit is contained in:
Christoph M. Becker 2018-08-23 12:44:06 +02:00
parent 32a728d351
commit 6644bd005f

View File

@ -1,24 +1,16 @@
--TEST--
Bug #76778 (array_reduce leaks memory if callback throws exception)
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
?>
--INI--
memory_limit=128M
--FILE--
<?php
for ($i = 0; $i < 100; $i++) {
try {
array_reduce(
[1],
function ($carry, $item) {
throw new Exception;
},
range(1, 200000)
);
} catch (Exception $e) {
}
try {
array_reduce(
[1],
function ($carry, $item) {
throw new Exception;
},
range(1, 3)
);
} catch (Exception $e) {
}
?>
===DONE===