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