1--TEST-- 2SPL: Cloning an instance of ArrayObject which wraps an object. 3--FILE-- 4<?php 5class C { } 6 7$c = new C; 8$ao1 = new ArrayObject($c); 9$c->p1 = 'new prop added to c before clone'; 10 11$ao2 = clone $ao1; 12 13$c->p2 = 'new prop added to c after clone'; 14$ao1['new.ao1'] = 'new element added to ao1'; 15$ao2['new.ao2'] = 'new element added to ao2'; 16var_dump($c, $ao1, $ao2); 17?> 18--EXPECT-- 19object(C)#1 (3) { 20 ["p1"]=> 21 string(32) "new prop added to c before clone" 22 ["p2"]=> 23 string(31) "new prop added to c after clone" 24 ["new.ao1"]=> 25 string(24) "new element added to ao1" 26} 27object(ArrayObject)#2 (1) { 28 ["storage":"ArrayObject":private]=> 29 object(C)#1 (3) { 30 ["p1"]=> 31 string(32) "new prop added to c before clone" 32 ["p2"]=> 33 string(31) "new prop added to c after clone" 34 ["new.ao1"]=> 35 string(24) "new element added to ao1" 36 } 37} 38object(ArrayObject)#3 (1) { 39 ["storage":"ArrayObject":private]=> 40 array(2) { 41 ["p1"]=> 42 string(32) "new prop added to c before clone" 43 ["new.ao2"]=> 44 string(24) "new element added to ao2" 45 } 46} 47