xref: /PHP-8.2/ext/standard/tests/array/bug76778.phpt (revision 6644bd00)
1--TEST--
2Bug #76778 (array_reduce leaks memory if callback throws exception)
3--FILE--
4<?php
5try {
6    array_reduce(
7        [1],
8        function ($carry, $item) {
9            throw new Exception;
10        },
11        range(1, 3)
12    );
13} catch (Exception $e) {
14}
15?>
16===DONE===
17--EXPECT--
18===DONE===
19