addslashes_error.phpt [plain text]
--TEST--
Test addslashes() function : error conditions
--FILE--
<?php
echo "*** Testing addslashes() : error conditions ***\n";
echo "\n-- Testing addslashes() function with Zero arguments --\n";
var_dump( addslashes() );
echo "\n-- Testing addslashes() function with more than expected no. of arguments --\n";
$str = '"hello"\"world"';
$extra_arg = 10;
var_dump( addslashes($str, $extra_arg) );
var_dump( $str );
echo "Done\n";
?>
--EXPECTF--
*** Testing addslashes() : error conditions ***
-- Testing addslashes() function with Zero arguments --
Warning: addslashes() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-- Testing addslashes() function with more than expected no. of arguments --
Warning: addslashes() expects exactly 1 parameter, 2 given in %s on line %d
NULL
string(15) ""hello"\"world""
Done