1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/spl/tests/ArrayObject/array_028.phpt

30 lines
573 B
PHP

--TEST--
ArrayObject/Iterator on array with NUL bytes
--FILE--
<?php
$array = [
"\0foo" => "bar",
];
$it = new ArrayIterator($array);
foreach ($it as $v) {
var_dump($v);
}
$obj = new ArrayObject($array);
foreach ($obj as $v) {
var_dump($v);
}
$obj = new ArrayObject($it);
foreach ($obj as $v) {
var_dump($v);
}
?>
--EXPECTF--
string(3) "bar"
string(3) "bar"
Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
string(3) "bar"