mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
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:
parent
32a728d351
commit
6644bd005f
@ -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===
|
||||
|
Loading…
Reference in New Issue
Block a user