1--TEST--
2SPL: Cloning nested ArrayObjects.
3--FILE--
4<?php
5class C {
6	public $p = 'C::p.orig';
7}
8
9$wrappedObject = new C;
10$innerArrayObject = new ArrayObject($wrappedObject);
11
12$outerArrayObject =  new ArrayObject($innerArrayObject);
13
14$wrappedObject->dynamic1 = 'new prop added to $wrappedObject before clone';
15$clonedOuterArrayObject = clone $outerArrayObject;
16$wrappedObject->dynamic2 = 'new prop added to $wrappedObject after clone';
17
18$innerArrayObject['new.iAO'] = 'new element added $innerArrayObject';
19$outerArrayObject['new.oAO'] = 'new element added to $outerArrayObject';
20$clonedOuterArrayObject['new.coAO'] = 'new element added to $clonedOuterArrayObject';
21
22var_dump($wrappedObject, $innerArrayObject, $outerArrayObject, $clonedOuterArrayObject);
23?>
24--EXPECTF--
25object(C)#1 (5) {
26  ["p"]=>
27  string(9) "C::p.orig"
28  ["dynamic1"]=>
29  string(45) "new prop added to $wrappedObject before clone"
30  ["dynamic2"]=>
31  string(44) "new prop added to $wrappedObject after clone"
32  ["new.iAO"]=>
33  string(35) "new element added $innerArrayObject"
34  ["new.oAO"]=>
35  string(38) "new element added to $outerArrayObject"
36}
37object(ArrayObject)#2 (1) {
38  ["storage":"ArrayObject":private]=>
39  object(C)#1 (5) {
40    ["p"]=>
41    string(9) "C::p.orig"
42    ["dynamic1"]=>
43    string(45) "new prop added to $wrappedObject before clone"
44    ["dynamic2"]=>
45    string(44) "new prop added to $wrappedObject after clone"
46    ["new.iAO"]=>
47    string(35) "new element added $innerArrayObject"
48    ["new.oAO"]=>
49    string(38) "new element added to $outerArrayObject"
50  }
51}
52object(ArrayObject)#3 (1) {
53  ["storage":"ArrayObject":private]=>
54  object(ArrayObject)#2 (1) {
55    ["storage":"ArrayObject":private]=>
56    object(C)#1 (5) {
57      ["p"]=>
58      string(9) "C::p.orig"
59      ["dynamic1"]=>
60      string(45) "new prop added to $wrappedObject before clone"
61      ["dynamic2"]=>
62      string(44) "new prop added to $wrappedObject after clone"
63      ["new.iAO"]=>
64      string(35) "new element added $innerArrayObject"
65      ["new.oAO"]=>
66      string(38) "new element added to $outerArrayObject"
67    }
68  }
69}
70object(ArrayObject)#4 (1) {
71  ["storage":"ArrayObject":private]=>
72  array(3) {
73    ["p"]=>
74    string(9) "C::p.orig"
75    ["dynamic1"]=>
76    string(45) "new prop added to $wrappedObject before clone"
77    ["new.coAO"]=>
78    string(44) "new element added to $clonedOuterArrayObject"
79  }
80}
81