1--TEST-- 2SPL: ArrayObject::exchangeArray() with various object arguments 3--FILE-- 4<?php 5echo "--> exchangeArray(array):\n"; 6$ao = new ArrayObject(); 7$ao->exchangeArray(array('key'=>'original')); 8var_dump($ao['key']); 9var_dump($ao); 10 11echo "\n--> exchangeArray(normal object):\n"; 12$obj = new stdClass; 13$obj->key = 'normal object prop'; 14$ao->exchangeArray($obj); 15var_dump($ao['key']); 16var_dump($ao); 17 18echo "\n--> exchangeArray(ArrayObject):\n"; 19$obj = new ArrayObject(array('key'=>'ArrayObject element')); 20$ao->exchangeArray($obj); 21var_dump($ao['key']); 22var_dump($ao); 23 24echo "\n--> exchangeArray(ArrayIterator):\n"; 25$obj = new ArrayIterator(array('key'=>'ArrayIterator element')); 26$ao->exchangeArray($obj); 27var_dump($ao['key']); 28var_dump($ao); 29 30echo "\n--> exchangeArray(nested ArrayObject):\n"; 31$obj = new ArrayObject(new ArrayObject(array('key'=>'nested ArrayObject element'))); 32$ao->exchangeArray($obj); 33var_dump($ao['key']); 34var_dump($ao); 35?> 36--EXPECTF-- 37--> exchangeArray(array): 38string(8) "original" 39object(ArrayObject)#%d (1) { 40 ["storage":"ArrayObject":private]=> 41 array(1) { 42 ["key"]=> 43 string(8) "original" 44 } 45} 46 47--> exchangeArray(normal object): 48string(18) "normal object prop" 49object(ArrayObject)#%d (1) { 50 ["storage":"ArrayObject":private]=> 51 object(stdClass)#%d (1) { 52 ["key"]=> 53 string(18) "normal object prop" 54 } 55} 56 57--> exchangeArray(ArrayObject): 58string(19) "ArrayObject element" 59object(ArrayObject)#%d (1) { 60 ["storage":"ArrayObject":private]=> 61 object(ArrayObject)#%d (1) { 62 ["storage":"ArrayObject":private]=> 63 array(1) { 64 ["key"]=> 65 string(19) "ArrayObject element" 66 } 67 } 68} 69 70--> exchangeArray(ArrayIterator): 71string(21) "ArrayIterator element" 72object(ArrayObject)#%d (1) { 73 ["storage":"ArrayObject":private]=> 74 object(ArrayIterator)#%d (1) { 75 ["storage":"ArrayIterator":private]=> 76 array(1) { 77 ["key"]=> 78 string(21) "ArrayIterator element" 79 } 80 } 81} 82 83--> exchangeArray(nested ArrayObject): 84string(26) "nested ArrayObject element" 85object(ArrayObject)#%d (1) { 86 ["storage":"ArrayObject":private]=> 87 object(ArrayObject)#%d (1) { 88 ["storage":"ArrayObject":private]=> 89 object(ArrayObject)#%d (1) { 90 ["storage":"ArrayObject":private]=> 91 array(1) { 92 ["key"]=> 93 string(26) "nested ArrayObject element" 94 } 95 } 96 } 97}