xref: /PHP-8.2/Zend/tests/bug37715.phpt (revision 7aacc705)
1--TEST--
2Bug #37715 (array pointers resetting on copy)
3--FILE--
4<?php
5$a = array(
6    'a' => array(
7        'A', 'B', 'C', 'D',
8    ),
9    'b' => array(
10        'AA', 'BB', 'CC', 'DD',
11    ),
12);
13
14// Set the pointer of $a to 'b' and the pointer of 'b' to 'CC'
15reset($a);
16next($a);
17next($a['b']);
18next($a['b']);
19next($a['b']);
20
21var_dump(key($a['b']));
22foreach($a as $k => $d)
23{
24}
25// Alternatively $c = $a; and foreachloop removal will cause identical results.
26var_dump(key($a['b']));
27?>
28--EXPECT--
29int(3)
30int(3)
31