Annotation of embedaddon/php/ext/standard/tests/strings/addslashes_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test addslashes() function : error conditions
3: --FILE--
4: <?php
5: /* Prototype : string addslashes ( string $str )
6: * Description: Returns a string with backslashes before characters that need to be quoted in database queries etc.
7: * Source code: ext/standard/string.c
8: */
9:
10: /*
11: * Testing addslashes() for error conditions
12: */
13:
14: echo "*** Testing addslashes() : error conditions ***\n";
15:
16: // Zero argument
17: echo "\n-- Testing addslashes() function with Zero arguments --\n";
18: var_dump( addslashes() );
19:
20: // More than expected number of arguments
21: echo "\n-- Testing addslashes() function with more than expected no. of arguments --\n";
22: $str = '"hello"\"world"';
23: $extra_arg = 10;
24:
25: var_dump( addslashes($str, $extra_arg) );
26: var_dump( $str );
27:
28: echo "Done\n";
29: ?>
30: --EXPECTF--
31: *** Testing addslashes() : error conditions ***
32:
33: -- Testing addslashes() function with Zero arguments --
34:
35: Warning: addslashes() expects exactly 1 parameter, 0 given in %s on line %d
36: NULL
37:
38: -- Testing addslashes() function with more than expected no. of arguments --
39:
40: Warning: addslashes() expects exactly 1 parameter, 2 given in %s on line %d
41: NULL
42: string(15) ""hello"\"world""
43: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>