xref: /PHP-8.3/Zend/tests/bug67856.phpt (revision 5b4bf4d3)
1--TEST--
2Bug #67856 (Leak when using array_reduce with by-ref function)
3--FILE--
4<?php
5$array = [1, 2, 3];
6var_dump(array_reduce($array, function(&$a, &$b) {
7    return $a + $b;
8}, 0));
9?>
10--EXPECTF--
11Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d
12
13Warning: {closure}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d
14
15Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d
16
17Warning: {closure}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d
18
19Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d
20
21Warning: {closure}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d
22int(6)
23