xref: /PHP-7.2/ext/mbstring/tests/mb_ereg1.phpt (revision 17ccbeec)
1--TEST--
2mb_ereg() and invalid arguments
3--SKIPIF--
4<?php if (!function_exists("mb_ereg")) print "skip"; ?>
5--FILE--
6<?php
7
8$a = array(
9	array(1,2,3),
10	array("", "", ""),
11	array(array(), 1, ""),
12	array(1, array(), ""),
13	array(1, "", array()),
14	);
15
16foreach ($a as $args) {
17	var_dump(mb_ereg($args[0], $args[1], $args[2]));
18	var_dump($args);
19}
20?>
21===DONE===
22--EXPECTF--
23bool(false)
24array(3) {
25  [0]=>
26  int(1)
27  [1]=>
28  int(2)
29  [2]=>
30  array(0) {
31  }
32}
33
34Warning: mb_ereg(): empty pattern in %s on line %d
35bool(false)
36array(3) {
37  [0]=>
38  string(0) ""
39  [1]=>
40  string(0) ""
41  [2]=>
42  array(0) {
43  }
44}
45
46Notice: Array to string conversion in %s on line %d
47bool(false)
48array(3) {
49  [0]=>
50  array(0) {
51  }
52  [1]=>
53  int(1)
54  [2]=>
55  array(0) {
56  }
57}
58
59Warning: mb_ereg() expects parameter 2 to be string, array given in %s on line %d
60bool(false)
61array(3) {
62  [0]=>
63  int(1)
64  [1]=>
65  array(0) {
66  }
67  [2]=>
68  string(0) ""
69}
70bool(false)
71array(3) {
72  [0]=>
73  int(1)
74  [1]=>
75  string(0) ""
76  [2]=>
77  array(0) {
78  }
79}
80===DONE===
81