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