1--TEST--
2Test spliti() function : usage variations  - unexpected type for arg 1
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$string = '1 a 1 Array 1 c ';
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 pattern
74
75foreach($values as $value) {
76      echo "\nArg value $value \n";
77      var_dump( spliti($value, $string, $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(16) "1 a 1 Array 1 c "
92}
93
94Arg value 1
95Error: 8192 - Function spliti() is deprecated, %s(74)
96array(4) {
97  [0]=>
98  string(0) ""
99  [1]=>
100  string(3) " a "
101  [2]=>
102  string(7) " Array "
103  [3]=>
104  string(3) " c "
105}
106
107Arg value 12345
108Error: 8192 - Function spliti() is deprecated, %s(74)
109array(1) {
110  [0]=>
111  string(16) "1 a 1 Array 1 c "
112}
113
114Arg value -2345
115Error: 8192 - Function spliti() is deprecated, %s(74)
116array(1) {
117  [0]=>
118  string(16) "1 a 1 Array 1 c "
119}
120
121Arg value 10.5
122Error: 8192 - Function spliti() is deprecated, %s(74)
123array(1) {
124  [0]=>
125  string(16) "1 a 1 Array 1 c "
126}
127
128Arg value -10.5
129Error: 8192 - Function spliti() is deprecated, %s(74)
130array(1) {
131  [0]=>
132  string(16) "1 a 1 Array 1 c "
133}
134
135Arg value 101234567000
136Error: 8192 - Function spliti() is deprecated, %s(74)
137array(1) {
138  [0]=>
139  string(16) "1 a 1 Array 1 c "
140}
141
142Arg value 1.07654321E-9
143Error: 8192 - Function spliti() is deprecated, %s(74)
144array(1) {
145  [0]=>
146  string(16) "1 a 1 Array 1 c "
147}
148
149Arg value 0.5
150Error: 8192 - Function spliti() is deprecated, %s(74)
151array(1) {
152  [0]=>
153  string(16) "1 a 1 Array 1 c "
154}
155
156Arg value Array
157Error: 8192 - Function spliti() is deprecated, %s(74)
158Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
159NULL
160
161Arg value Array
162Error: 8192 - Function spliti() is deprecated, %s(74)
163Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
164NULL
165
166Arg value Array
167Error: 8192 - Function spliti() is deprecated, %s(74)
168Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
169NULL
170
171Arg value Array
172Error: 8192 - Function spliti() is deprecated, %s(74)
173Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
174NULL
175
176Arg value Array
177Error: 8192 - Function spliti() is deprecated, %s(74)
178Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
179NULL
180
181Arg value
182Error: 8192 - Function spliti() is deprecated, %s(74)
183Error: 2 - spliti(): REG_EMPTY, %s(74)
184bool(false)
185
186Arg value
187Error: 8192 - Function spliti() is deprecated, %s(74)
188Error: 2 - spliti(): REG_EMPTY, %s(74)
189bool(false)
190
191Arg value 1
192Error: 8192 - Function spliti() is deprecated, %s(74)
193array(4) {
194  [0]=>
195  string(0) ""
196  [1]=>
197  string(3) " a "
198  [2]=>
199  string(7) " Array "
200  [3]=>
201  string(3) " c "
202}
203
204Arg value
205Error: 8192 - Function spliti() is deprecated, %s(74)
206Error: 2 - spliti(): REG_EMPTY, %s(74)
207bool(false)
208
209Arg value 1
210Error: 8192 - Function spliti() is deprecated, %s(74)
211array(4) {
212  [0]=>
213  string(0) ""
214  [1]=>
215  string(3) " a "
216  [2]=>
217  string(7) " Array "
218  [3]=>
219  string(3) " c "
220}
221
222Arg value
223Error: 8192 - Function spliti() is deprecated, %s(74)
224Error: 2 - spliti(): REG_EMPTY, %s(74)
225bool(false)
226
227Arg value
228Error: 8192 - Function spliti() is deprecated, %s(74)
229Error: 2 - spliti(): REG_EMPTY, %s(74)
230bool(false)
231
232Arg value
233Error: 8192 - Function spliti() is deprecated, %s(74)
234Error: 2 - spliti(): REG_EMPTY, %s(74)
235bool(false)
236Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
237
238Arg value
239Error: 8192 - Function spliti() is deprecated, %s(74)
240Error: 2 - spliti() expects parameter 1 to be string, object given, %s(74)
241NULL
242
243Arg value
244Error: 8192 - Function spliti() is deprecated, %s(74)
245Error: 2 - spliti(): REG_EMPTY, %s(74)
246bool(false)
247
248Arg value
249Error: 8192 - Function spliti() is deprecated, %s(74)
250Error: 2 - spliti(): REG_EMPTY, %s(74)
251bool(false)
252Done
253