xref: /PHP-8.3/Zend/tests/gh11244-003.phpt (revision cd53ce83)
1--TEST--
2GH-11244: Modifying a copied by-ref iterated array resets the array position (not packed with holes)
3--FILE--
4<?php
5
6$data = ["k" => 0, 1, 2, 3];
7unset($data[1]);
8
9foreach ($data as $key => &$value) {
10    echo "$value\n";
11    if ($value === 1) {
12        $cow_copy = $data;
13        echo "unset $value\n";
14        unset($data[$key]);
15    }
16}
17
18?>
19--EXPECTF--
200
211
22unset 1
233
24