xref: /PHP-8.0/Zend/tests/bug73753.phpt (revision ded3d984)
1--TEST--
2Bug #73753 Non packed arrays and duplication
3--FILE--
4<?php
5function iterate($current, $a, $result = null) {
6    if (!$current) {
7        return $result;
8    }
9
10    return iterate(getNext($a), $a, $current);
11}
12
13function getNext(&$a) {
14    return next($a);
15}
16
17function getCurrent($a) {
18    return current($a);
19}
20
21function traverse($a) {
22    return iterate(getCurrent($a), $a);
23}
24
25$arr = array(1 => 'foo', 'b' => 'bar', 'baz');
26var_dump(traverse($arr));
27?>
28--EXPECT--
29string(3) "baz"
30