Skip to content

Commit 6644bd0

Browse files
committed
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.
1 parent 32a728d commit 6644bd0

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

ext/standard/tests/array/bug76778.phpt

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
--TEST--
22
Bug #76778 (array_reduce leaks memory if callback throws exception)
3-
--SKIPIF--
4-
<?php
5-
if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
6-
?>
7-
--INI--
8-
memory_limit=128M
93
--FILE--
104
<?php
11-
for ($i = 0; $i < 100; $i++) {
12-
try {
13-
array_reduce(
14-
[1],
15-
function ($carry, $item) {
16-
throw new Exception;
17-
},
18-
range(1, 200000)
19-
);
20-
} catch (Exception $e) {
21-
}
5+
try {
6+
array_reduce(
7+
[1],
8+
function ($carry, $item) {
9+
throw new Exception;
10+
},
11+
range(1, 3)
12+
);
13+
} catch (Exception $e) {
2214
}
2315
?>
2416
===DONE===

0 commit comments

Comments
 (0)