1--TEST-- 2Test mb_ereg_match() function : error conditions - pass function incorrect number of arguments 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_ereg_match') or die("skip mb_ereg_match() is not available in this build"); 7?> 8--FILE-- 9<?php 10/* Prototype : bool mb_ereg_match(string $pattern, string $string [,string $option]) 11 * Description: Regular expression match for multibyte string 12 * Source code: ext/mbstring/php_mbregex.c 13 */ 14 15/* 16 * Test mb_ereg_match by passing an incorrect number of arguments 17 */ 18 19echo "*** Testing mb_ereg_match() : error conditions ***\n"; 20 21 22//Test mb_ereg_match with one more than the expected number of arguments 23echo "\n-- Testing mb_ereg_match() function with more than expected no. of arguments --\n"; 24$pattern = b'string_val'; 25$string = b'string_val'; 26$option = 'string_val'; 27$extra_arg = 10; 28var_dump( mb_ereg_match($pattern, $string, $option, $extra_arg) ); 29 30// Testing mb_ereg_match with one less than the expected number of arguments 31echo "\n-- Testing mb_ereg_match() function with less than expected no. of arguments --\n"; 32$pattern = b'string_val'; 33var_dump( mb_ereg_match($pattern) ); 34 35// Testing mb_ereg_match with zero arguments 36echo "\n-- Testing mb_ereg_match() function with zero arguments --\n"; 37var_dump( mb_ereg_match() ); 38 39echo "Done"; 40?> 41--EXPECTF-- 42*** Testing mb_ereg_match() : error conditions *** 43 44-- Testing mb_ereg_match() function with more than expected no. of arguments -- 45 46Warning: mb_ereg_match() expects at most 3 parameters, 4 given in %s on line %d 47bool(false) 48 49-- Testing mb_ereg_match() function with less than expected no. of arguments -- 50 51Warning: mb_ereg_match() expects at least 2 parameters, 1 given in %s on line %d 52bool(false) 53 54-- Testing mb_ereg_match() function with zero arguments -- 55 56Warning: mb_ereg_match() expects at least 2 parameters, 0 given in %s on line %d 57bool(false) 58Done 59