Annotation of embedaddon/php/ext/standard/tests/serialize/serialization_error_001.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test serialize() & unserialize() functions: error conditions - wrong number of args.
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: echo "*** Testing serialize()/unserialize() : error conditions ***\n";
17:
18: // Zero arguments
19: var_dump( serialize() );
20: var_dump( unserialize() );
21:
22: //Test serialize with one more than the expected number of arguments
23: var_dump( serialize(1,2) );
24: var_dump( unserialize(1,2) );
25:
26: echo "Done";
27: ?>
28: --EXPECTF--
29: *** Testing serialize()/unserialize() : error conditions ***
30:
31: Warning: serialize() expects exactly 1 parameter, 0 given in %s on line 16
32: NULL
33:
34: Warning: unserialize() expects exactly 1 parameter, 0 given in %s on line 17
35: bool(false)
36:
37: Warning: serialize() expects exactly 1 parameter, 2 given in %s on line 20
38: NULL
39:
40: Warning: unserialize() expects exactly 1 parameter, 2 given in %s on line 21
41: bool(false)
42: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>