1--TEST-- 2Test mb_strlen() function : error conditions - pass incorrect number of args 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_strlen') or die("skip mb_strlen() is not available in this build"); 7?> 8--FILE-- 9<?php 10/* Prototype : int mb_strlen(string $str [, string $encoding]) 11 * Description: Get character numbers of a string 12 * Source code: ext/mbstring/mbstring.c 13 */ 14 15/* 16 * Pass mb_strlen an incorrect number of arguments to test behaviour 17 */ 18 19echo "*** Testing mb_strlen() : error conditions ***\n"; 20 21// Zero arguments 22echo "\n-- Testing mb_strlen() function with Zero arguments --\n"; 23var_dump( mb_strlen() ); 24 25//Test mb_strlen with one more than the expected number of arguments 26echo "\n-- Testing mb_strlen() function with more than expected no. of arguments --\n"; 27$str = 'string_val'; 28$encoding = 'string_val'; 29$extra_arg = 10; 30var_dump( mb_strlen($str, $encoding, $extra_arg) ); 31 32echo "Done"; 33?> 34--EXPECTF-- 35*** Testing mb_strlen() : error conditions *** 36 37-- Testing mb_strlen() function with Zero arguments -- 38 39Warning: mb_strlen() expects at least 1 parameter, 0 given in %s on line %d 40bool(false) 41 42-- Testing mb_strlen() function with more than expected no. of arguments -- 43 44Warning: mb_strlen() expects at most 2 parameters, 3 given in %s on line %d 45bool(false) 46Done 47