xref: /PHP-7.2/ext/spl/tests/array_018.phpt (revision 610c7fbe)
1--TEST--
2SPL: ArrayObject and \0
3--FILE--
4<?php
5
6try
7{
8	$foo = new ArrayObject();
9	$foo->offsetSet("\0", "Foo");
10}
11catch (Exception $e)
12{
13	var_dump($e->getMessage());
14}
15
16var_dump($foo);
17
18try
19{
20	$foo = new ArrayObject();
21	$data = explode("=", "=Foo");
22	$foo->offsetSet($data[0], $data[1]);
23}
24catch (Exception $e)
25{
26	var_dump($e->getMessage());
27}
28
29var_dump($foo);
30
31?>
32===DONE===
33--EXPECTF--
34object(ArrayObject)#1 (1) {
35  ["storage":"ArrayObject":private]=>
36  array(1) {
37    ["�"]=>
38    string(3) "Foo"
39  }
40}
41object(ArrayObject)#2 (1) {
42  ["storage":"ArrayObject":private]=>
43  array(1) {
44    [""]=>
45    string(3) "Foo"
46  }
47}
48===DONE===
49