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