Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / iconv / tests / iconv_strpos_error1.phpt
blob232466562c47b7bfaf93f49af3fddb65552b712e
1 --TEST--
2 Test iconv_strpos() function : error conditions - Pass incorrect number of args
3 --SKIPIF--
4 <?php
5 extension_loaded('iconv') or die('skip');
6 function_exists('iconv_strpos') or die("skip iconv_strpos() is not available in this build");
7 ?>
8 --FILE--
9 <?php
10 /* Prototype  : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
11  * Description: Find position of first occurrence of a string within another 
12  * Source code: ext/iconv/iconv.c
13  */
16  * Test how iconv_strpos behaves when passed an incorrect number of arguments
17  */
19 echo "*** Testing iconv_strpos() : error conditions ***\n";
22 //Test iconv_strpos with one more than the expected number of arguments
23 echo "\n-- Testing iconv_strpos() function with more than expected no. of arguments --\n";
24 $haystack = 'string_val';
25 $needle = 'string_val';
26 $offset = 10;
27 $encoding = 'string_val';
28 $extra_arg = 10;
29 var_dump( iconv_strpos($haystack, $needle, $offset, $encoding, $extra_arg) );
31 // Testing iconv_strpos with one less than the expected number of arguments
32 echo "\n-- Testing iconv_strpos() function with less than expected no. of arguments --\n";
33 $haystack = 'string_val';
34 var_dump( iconv_strpos($haystack) );
36 echo "Done";
38 --EXPECTF--
39 *** Testing iconv_strpos() : error conditions ***
41 -- Testing iconv_strpos() function with more than expected no. of arguments --
43 Warning: iconv_strpos() expects at most 4 parameters, 5 given in %s on line %d
44 bool(false)
46 -- Testing iconv_strpos() function with less than expected no. of arguments --
48 Warning: iconv_strpos() expects at least 2 parameters, 1 given in %s on line %d
49 bool(false)
50 Done