xref: /PHP-5.5/ext/spl/tests/bug49263.phpt (revision 89e93723)
1--TEST--
2SPL: SplObjectStorage serialization references
3--SKIPIF--
4<?php if (!extension_loaded("spl")) print "skip"; ?>
5--FILE--
6<?php
7$o1 = new stdClass;
8$o2 = new stdClass;
9
10$s = new splObjectStorage();
11
12$s->attach($o1, array('prev' => 2, 'next' => $o2));
13$s->attach($o2, array('prev' => $o1));
14
15$ss = serialize($s);
16unset($s,$o1,$o2);
17echo $ss."\n";
18var_dump(unserialize($ss));
19?>
20===DONE===
21--EXPECTF--
22C:16:"SplObjectStorage":113:{x:i:2;O:8:"stdClass":0:{},a:2:{s:4:"prev";i:2;s:4:"next";O:8:"stdClass":0:{}};r:6;,a:1:{s:4:"prev";r:3;};m:a:0:{}}
23object(SplObjectStorage)#2 (1) {
24  ["storage":"SplObjectStorage":private]=>
25  array(2) {
26    ["%s"]=>
27    array(2) {
28      ["obj"]=>
29      object(stdClass)#1 (0) {
30      }
31      ["inf"]=>
32      array(2) {
33        ["prev"]=>
34        int(2)
35        ["next"]=>
36        object(stdClass)#3 (0) {
37        }
38      }
39    }
40    ["%s"]=>
41    array(2) {
42      ["obj"]=>
43      object(stdClass)#3 (0) {
44      }
45      ["inf"]=>
46      array(1) {
47        ["prev"]=>
48        object(stdClass)#1 (0) {
49        }
50      }
51    }
52  }
53}
54===DONE===
55