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