Annotation of embedaddon/php/ext/standard/tests/serialize/serialization_objects_004.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test serialize() & unserialize() functions: objects - ensure that COW references of objects are not serialized separately (unlike other types). 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : proto string serialize(mixed variable)
                      6:  * Description: Returns a string representation of variable (which can later be unserialized) 
                      7:  * Source code: ext/standard/var.c
                      8:  * Alias to functions: 
                      9:  */
                     10: /* Prototype  : proto mixed unserialize(string variable_representation)
                     11:  * Description: Takes a string representation of variable and recreates it 
                     12:  * Source code: ext/standard/var.c
                     13:  * Alias to functions: 
                     14:  */
                     15: 
                     16: $x = new stdClass;
                     17: $ref = &$x;
                     18: var_dump(serialize(array($x, $x)));
                     19: 
                     20: $x = 1;
                     21: $ref = &$x;
                     22: var_dump(serialize(array($x, $x)));
                     23: 
                     24: $x = "a";
                     25: $ref = &$x;
                     26: var_dump(serialize(array($x, $x)));
                     27: 
                     28: $x = true;
                     29: $ref = &$x;
                     30: var_dump(serialize(array($x, $x)));
                     31: 
                     32: $x = null;
                     33: $ref = &$x;
                     34: var_dump(serialize(array($x, $x)));
                     35: 
                     36: $x = array();
                     37: $ref = &$x;
                     38: var_dump(serialize(array($x, $x)));
                     39: 
                     40: echo "Done";
                     41: ?>
                     42: --EXPECTF--
                     43: string(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;r:2;}"
                     44: string(22) "a:2:{i:0;i:1;i:1;i:1;}"
                     45: string(30) "a:2:{i:0;s:1:"a";i:1;s:1:"a";}"
                     46: string(22) "a:2:{i:0;b:1;i:1;b:1;}"
                     47: string(18) "a:2:{i:0;N;i:1;N;}"
                     48: string(26) "a:2:{i:0;a:0:{}i:1;a:0:{}}"
                     49: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>