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