summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/bug76778.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/array/bug76778.phpt')
-rw-r--r--ext/standard/tests/array/bug76778.phpt26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/standard/tests/array/bug76778.phpt b/ext/standard/tests/array/bug76778.phpt
new file mode 100644
index 0000000000..2c65497d12
--- /dev/null
+++ b/ext/standard/tests/array/bug76778.phpt
@@ -0,0 +1,26 @@
+--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=32M
+--FILE--
+<?php
+for ($i = 0; $i < 100; $i++) {
+ try {
+ array_reduce(
+ [1],
+ function ($carry, $item) {
+ throw new Exception;
+ },
+ range(1, 200000)
+ );
+ } catch (Exception $e) {
+ }
+}
+?>
+===DONE===
+--EXPECT--
+===DONE===