1--TEST-- 2Test mb_strstr() function : error conditions 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build"); 7?> 8--FILE-- 9<?php 10/* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]]) 11 * Description: Finds first occurrence of a string within another 12 * Source code: ext/mbstring/mbstring.c 13 * Alias to functions: 14 */ 15 16echo "*** Testing mb_strstr() : error conditions ***\n"; 17 18 19//Test mb_strstr with one more than the expected number of arguments 20echo "\n-- Testing mb_strstr() function with more than expected no. of arguments --\n"; 21$haystack = 'string_val'; 22$needle = 'string_val'; 23$part = true; 24$encoding = 'string_val'; 25$extra_arg = 10; 26var_dump( mb_strstr($haystack, $needle, $part, $encoding, $extra_arg) ); 27 28// Testing mb_strstr with one less than the expected number of arguments 29echo "\n-- Testing mb_strstr() function with less than expected no. of arguments --\n"; 30$haystack = 'string_val'; 31var_dump( mb_strstr($haystack) ); 32 33?> 34===DONE=== 35--EXPECTF-- 36*** Testing mb_strstr() : error conditions *** 37 38-- Testing mb_strstr() function with more than expected no. of arguments -- 39 40Warning: mb_strstr() expects at most 4 parameters, 5 given in %s on line %d 41NULL 42 43-- Testing mb_strstr() function with less than expected no. of arguments -- 44 45Warning: mb_strstr() expects at least 2 parameters, 1 given in %s on line %d 46NULL 47===DONE=== 48