1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/spl/tests/array_025.phpt
Alex Dowad 0d11d37357 Fix bug #67369 ArrayObject serializatino drops the iterator class
When ArrayObject is round-tripped through serialize() and unserialize(),
it forgets any iterator class name which was set using ::setIteratorClass().
Fix that.
2020-04-20 11:55:18 +02:00

41 lines
856 B
PHP

--TEST--
SPL: ArrayObject serialize with an object as storage
--FILE--
<?php
$obj1 = new ArrayObject(new ArrayObject(array(1,2)));
$s = serialize($obj1);
$obj2 = unserialize($s);
print_r($obj1);
echo "$s\n";
print_r($obj2);
?>
--EXPECT--
ArrayObject Object
(
[storage:ArrayObject:private] => ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[0] => 1
[1] => 2
)
)
)
O:11:"ArrayObject":4:{i:0;i:0;i:1;O:11:"ArrayObject":4:{i:0;i:0;i:1;a:2:{i:0;i:1;i:1;i:2;}i:2;a:0:{}i:3;N;}i:2;a:0:{}i:3;N;}
ArrayObject Object
(
[storage:ArrayObject:private] => ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[0] => 1
[1] => 2
)
)
)