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