php-src/Zend/tests/gh11244-001.phpt

23 lines
337 B
Plaintext
Raw Normal View History

2023-05-16 01:02:29 +00:00
--TEST--
GH-11244: Modifying a copied by-ref iterated array resets the array position (packed)
--FILE--
<?php
$data = [0, 1, 2];
foreach ($data as $key => &$value) {
echo "$value\n";
if ($value === 1) {
$cow_copy = $data;
echo "unset $value\n";
unset($data[$key]);
}
}
?>
--EXPECTF--
0
1
unset 1
2