1--TEST--
2Serialization of RC1 objects appearing in object graph twice
3--FILE--
4<?php
5
6function rcn() {
7    $root = new stdClass;
8    $end = new stdClass;
9    $root->a = [$end];
10    $root->b = $root->a;
11    unset($end);
12    echo serialize($root), "\n";
13}
14
15function rcn_rc1() {
16    $root = new stdClass;
17    $end = new stdClass;
18    $root->a = [[$end]];
19    $root->b = $root->a;
20    unset($end);
21    echo serialize($root), "\n";
22}
23
24function rcn_properties_ht() {
25    $object = new stdClass;
26    $object->object = new stdClass;
27    $array = (array) $object;
28    $root = [$object, $array];
29    unset($object);
30    unset($array);
31    echo serialize($root), "\n";
32}
33
34rcn();
35rcn_rc1();
36rcn_properties_ht();
37
38?>
39--EXPECT--
40O:8:"stdClass":2:{s:1:"a";a:1:{i:0;O:8:"stdClass":0:{}}s:1:"b";a:1:{i:0;r:3;}}
41O:8:"stdClass":2:{s:1:"a";a:1:{i:0;a:1:{i:0;O:8:"stdClass":0:{}}}s:1:"b";a:1:{i:0;a:1:{i:0;r:4;}}}
42a:2:{i:0;O:8:"stdClass":1:{s:6:"object";O:8:"stdClass":0:{}}i:1;a:1:{s:6:"object";r:3;}}
43