xref: /PHP-8.4/Zend/tests/gh13178_2.phpt (revision d6536468)
1--TEST--
2GH-13178: Unsetting last offset must floor iterator position
3--FILE--
4<?php
5$array = [100 => 'foo'];
6foreach ($array as $key => &$value) {
7    var_dump($key);
8    unset($array[$key]);
9    $array[] = 'foo';
10    if ($key === 110) {
11        break;
12    }
13}
14?>
15--EXPECT--
16int(100)
17int(101)
18int(102)
19int(103)
20int(104)
21int(105)
22int(106)
23int(107)
24int(108)
25int(109)
26int(110)
27