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