1--TEST--
2Test spliti() function : usage variations  - unexpected type for arg 3
3--FILE--
4<?php
5/* Prototype  : proto array spliti(string pattern, string string [, int limit])
6 * Description: spliti string into array by regular expression
7 * Source code: ext/standard/reg.c
8 * Alias to functions:
9 */
10
11function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
12	if (error_reporting() != 0) {
13		// report non-silenced errors
14		echo "Error: $err_no - $err_msg, $filename($linenum)\n";
15	}
16}
17set_error_handler('test_error_handler');
18echo "*** Testing spliti() : usage variations ***\n";
19
20// Initialise function arguments not being substituted (if any)
21$pattern = b'[[:space:]]';
22$string = '1 2 3 4 5';
23
24//get an unset variable
25$unset_var = 10;
26unset ($unset_var);
27
28//array of values to iterate over
29$values = array(
30
31      // float data
32      10.5,
33      -10.5,
34      10.7654321E-10,
35      .5,
36
37      // array data
38      array(),
39      array(0),
40      array(1),
41      array(1, 2),
42      array('color' => 'red', 'item' => 'pen'),
43
44      // null data
45      NULL,
46      null,
47
48      // boolean data
49      true,
50      false,
51      TRUE,
52      FALSE,
53
54      // empty data
55      "",
56      '',
57
58      // string data
59      "string",
60      'string',
61
62      // object data
63      new stdclass(),
64
65      // undefined data
66      @$undefined_var,
67
68      // unset data
69      @$unset_var,
70);
71
72// loop through each element of the array for limit
73
74foreach($values as $value) {
75      echo "\nArg value $value \n";
76      var_dump( spliti($pattern, $string, $value) );
77};
78
79echo "Done";
80?>
81--EXPECTF--
82*** Testing spliti() : usage variations ***
83
84Arg value 10.5
85Error: 8192 - Function spliti() is deprecated, %s(73)
86array(5) {
87  [0]=>
88  string(1) "1"
89  [1]=>
90  string(1) "2"
91  [2]=>
92  string(1) "3"
93  [3]=>
94  string(1) "4"
95  [4]=>
96  string(1) "5"
97}
98
99Arg value -10.5
100Error: 8192 - Function spliti() is deprecated, %s(73)
101array(1) {
102  [0]=>
103  string(9) "1 2 3 4 5"
104}
105
106Arg value 1.07654321E-9
107Error: 8192 - Function spliti() is deprecated, %s(73)
108array(1) {
109  [0]=>
110  string(9) "1 2 3 4 5"
111}
112
113Arg value 0.5
114Error: 8192 - Function spliti() is deprecated, %s(73)
115array(1) {
116  [0]=>
117  string(9) "1 2 3 4 5"
118}
119
120Arg value Array
121Error: 8192 - Function spliti() is deprecated, %s(73)
122Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
123NULL
124
125Arg value Array
126Error: 8192 - Function spliti() is deprecated, %s(73)
127Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
128NULL
129
130Arg value Array
131Error: 8192 - Function spliti() is deprecated, %s(73)
132Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
133NULL
134
135Arg value Array
136Error: 8192 - Function spliti() is deprecated, %s(73)
137Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
138NULL
139
140Arg value Array
141Error: 8192 - Function spliti() is deprecated, %s(73)
142Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
143NULL
144
145Arg value
146Error: 8192 - Function spliti() is deprecated, %s(73)
147array(1) {
148  [0]=>
149  string(9) "1 2 3 4 5"
150}
151
152Arg value
153Error: 8192 - Function spliti() is deprecated, %s(73)
154array(1) {
155  [0]=>
156  string(9) "1 2 3 4 5"
157}
158
159Arg value 1
160Error: 8192 - Function spliti() is deprecated, %s(73)
161array(1) {
162  [0]=>
163  string(9) "1 2 3 4 5"
164}
165
166Arg value
167Error: 8192 - Function spliti() is deprecated, %s(73)
168array(1) {
169  [0]=>
170  string(9) "1 2 3 4 5"
171}
172
173Arg value 1
174Error: 8192 - Function spliti() is deprecated, %s(73)
175array(1) {
176  [0]=>
177  string(9) "1 2 3 4 5"
178}
179
180Arg value
181Error: 8192 - Function spliti() is deprecated, %s(73)
182array(1) {
183  [0]=>
184  string(9) "1 2 3 4 5"
185}
186
187Arg value
188Error: 8192 - Function spliti() is deprecated, %s(73)
189Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
190NULL
191
192Arg value
193Error: 8192 - Function spliti() is deprecated, %s(73)
194Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
195NULL
196
197Arg value string
198Error: 8192 - Function spliti() is deprecated, %s(73)
199Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
200NULL
201
202Arg value string
203Error: 8192 - Function spliti() is deprecated, %s(73)
204Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
205NULL
206Error: 4096 - Object of class stdClass could not be converted to string, %s(72)
207
208Arg value
209Error: 8192 - Function spliti() is deprecated, %s(73)
210Error: 2 - spliti() expects parameter 3 to be long, object given, %s(73)
211NULL
212
213Arg value
214Error: 8192 - Function spliti() is deprecated, %s(73)
215array(1) {
216  [0]=>
217  string(9) "1 2 3 4 5"
218}
219
220Arg value
221Error: 8192 - Function spliti() is deprecated, %s(73)
222array(1) {
223  [0]=>
224  string(9) "1 2 3 4 5"
225}
226Done