xref: /PHP-8.1/ext/spl/tests/array_028.phpt (revision e0a39eec)
1--TEST--
2ArrayObject/Iterator on array with NUL bytes
3--FILE--
4<?php
5$array = [
6    "\0foo" => "bar",
7];
8
9$it = new ArrayIterator($array);
10foreach ($it as $v) {
11    var_dump($v);
12}
13
14$obj = new ArrayObject($array);
15foreach ($obj as $v) {
16    var_dump($v);
17}
18
19$obj = new ArrayObject($it);
20foreach ($obj as $v) {
21    var_dump($v);
22}
23?>
24--EXPECT--
25string(3) "bar"
26string(3) "bar"
27string(3) "bar"
28