1--TEST--
2Test 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
14echo "*** Testing addslashes() : error conditions ***\n";
15
16// Zero argument
17echo "\n-- Testing addslashes() function with Zero arguments --\n";
18var_dump( addslashes() );
19
20// More than expected number of arguments
21echo "\n-- Testing addslashes() function with more than expected no. of arguments --\n";
22$str = '"hello"\"world"';
23$extra_arg = 10;
24
25var_dump( addslashes($str, $extra_arg) );
26var_dump( $str );
27
28echo "Done\n";
29?>
30--EXPECTF--
31*** Testing addslashes() : error conditions ***
32
33-- Testing addslashes() function with Zero arguments --
34
35Warning: addslashes() expects exactly 1 parameter, 0 given in %s on line %d
36NULL
37
38-- Testing addslashes() function with more than expected no. of arguments --
39
40Warning: addslashes() expects exactly 1 parameter, 2 given in %s on line %d
41NULL
42string(15) ""hello"\"world""
43Done
44