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