xref: /PHP-8.1/ext/spl/tests/array_025.phpt (revision 0d11d373)
1--TEST--
2SPL: ArrayObject serialize with an object as storage
3--FILE--
4<?php
5$obj1 = new ArrayObject(new ArrayObject(array(1,2)));
6$s = serialize($obj1);
7$obj2 = unserialize($s);
8
9print_r($obj1);
10echo "$s\n";
11print_r($obj2);
12?>
13--EXPECT--
14ArrayObject Object
15(
16    [storage:ArrayObject:private] => ArrayObject Object
17        (
18            [storage:ArrayObject:private] => Array
19                (
20                    [0] => 1
21                    [1] => 2
22                )
23
24        )
25
26)
27O:11:"ArrayObject":4:{i:0;i:0;i:1;O:11:"ArrayObject":4:{i:0;i:0;i:1;a:2:{i:0;i:1;i:1;i:2;}i:2;a:0:{}i:3;N;}i:2;a:0:{}i:3;N;}
28ArrayObject Object
29(
30    [storage:ArrayObject:private] => ArrayObject Object
31        (
32            [storage:ArrayObject:private] => Array
33                (
34                    [0] => 1
35                    [1] => 2
36                )
37
38        )
39
40)
41