Annotation of embedaddon/php/ext/spl/tests/SplFixedArray_serialize.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SplFixedArray serialisation
! 3: --FILE--
! 4: <?php
! 5:
! 6: $array = new SplFixedArray(5);
! 7:
! 8: $obj = new stdClass;
! 9: $obj->prop = 'value';
! 10:
! 11: $array[0] = 'foo';
! 12: $array[2] = 42;
! 13: $array[3] = $obj;
! 14: $array[4] = range(1, 5);
! 15:
! 16: $ser = serialize($array);
! 17: echo "$ser\n";
! 18: $unser = unserialize($ser);
! 19:
! 20: printf("count: %d\n", count($unser));
! 21: printf("getSize(): %d\n", $unser->getSize());
! 22:
! 23: var_dump($unser[0], $unser[1], $unser[2], $unser[3], $unser[4]);
! 24:
! 25: $unser[4] = 'quux';
! 26: var_dump($unser[4]);
! 27:
! 28: ?>
! 29: --EXPECT--
! 30: O:13:"SplFixedArray":5:{i:0;s:3:"foo";i:1;N;i:2;i:42;i:3;O:8:"stdClass":1:{s:4:"prop";s:5:"value";}i:4;a:5:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:4;i:5;}}
! 31: count: 5
! 32: getSize(): 5
! 33: string(3) "foo"
! 34: NULL
! 35: int(42)
! 36: object(stdClass)#4 (1) {
! 37: ["prop"]=>
! 38: string(5) "value"
! 39: }
! 40: array(5) {
! 41: [0]=>
! 42: int(1)
! 43: [1]=>
! 44: int(2)
! 45: [2]=>
! 46: int(3)
! 47: [3]=>
! 48: int(4)
! 49: [4]=>
! 50: int(5)
! 51: }
! 52: string(4) "quux"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>