1--TEST--
2Test split() function : usage variations  - unexpected type for arg 2
3--FILE--
4<?php
5/* Prototype  : proto array split(string pattern, string string [, int limit])
6 * Description: Split 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 split() : 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( split($pattern, $value, $limit) );
78};
79
80echo "Done";
81?>
82--EXPECTF--
83*** Testing split() : 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 split() is deprecated, %s(74)
89array(1) {
90  [0]=>
91  string(1) "0"
92}
93
94Arg value 1
95Error: 8192 - Function split() is deprecated, %s(74)
96array(1) {
97  [0]=>
98  string(1) "1"
99}
100
101Arg value 12345
102Error: 8192 - Function split() is deprecated, %s(74)
103array(1) {
104  [0]=>
105  string(5) "12345"
106}
107
108Arg value -2345
109Error: 8192 - Function split() is deprecated, %s(74)
110array(1) {
111  [0]=>
112  string(5) "-2345"
113}
114
115Arg value 10.5
116Error: 8192 - Function split() is deprecated, %s(74)
117array(1) {
118  [0]=>
119  string(4) "10.5"
120}
121
122Arg value -10.5
123Error: 8192 - Function split() is deprecated, %s(74)
124array(1) {
125  [0]=>
126  string(5) "-10.5"
127}
128
129Arg value 101234567000
130Error: 8192 - Function split() is deprecated, %s(74)
131array(1) {
132  [0]=>
133  string(12) "101234567000"
134}
135
136Arg value 1.07654321E-9
137Error: 8192 - Function split() 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 split() is deprecated, %s(74)
147array(1) {
148  [0]=>
149  string(3) "0.5"
150}
151Error: 8 - Array to string conversion, %ssplit_variation_002.php(%d)
152
153Arg value Array
154Error: 8192 - Function split() is deprecated, %s(74)
155Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
156NULL
157Error: 8 - Array to string conversion, %ssplit_variation_002.php(%d)
158
159Arg value Array
160Error: 8192 - Function split() is deprecated, %s(74)
161Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
162NULL
163Error: 8 - Array to string conversion, %ssplit_variation_002.php(%d)
164
165Arg value Array
166Error: 8192 - Function split() is deprecated, %s(74)
167Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
168NULL
169Error: 8 - Array to string conversion, %ssplit_variation_002.php(%d)
170
171Arg value Array
172Error: 8192 - Function split() is deprecated, %s(74)
173Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
174NULL
175Error: 8 - Array to string conversion, %ssplit_variation_002.php(%d)
176
177Arg value Array
178Error: 8192 - Function split() is deprecated, %s(74)
179Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
180NULL
181
182Arg value
183Error: 8192 - Function split() is deprecated, %s(74)
184array(1) {
185  [0]=>
186  string(0) ""
187}
188
189Arg value
190Error: 8192 - Function split() is deprecated, %s(74)
191array(1) {
192  [0]=>
193  string(0) ""
194}
195
196Arg value 1
197Error: 8192 - Function split() is deprecated, %s(74)
198array(1) {
199  [0]=>
200  string(1) "1"
201}
202
203Arg value
204Error: 8192 - Function split() is deprecated, %s(74)
205array(1) {
206  [0]=>
207  string(0) ""
208}
209
210Arg value 1
211Error: 8192 - Function split() is deprecated, %s(74)
212array(1) {
213  [0]=>
214  string(1) "1"
215}
216
217Arg value
218Error: 8192 - Function split() is deprecated, %s(74)
219array(1) {
220  [0]=>
221  string(0) ""
222}
223
224Arg value
225Error: 8192 - Function split() is deprecated, %s(74)
226array(1) {
227  [0]=>
228  string(0) ""
229}
230
231Arg value
232Error: 8192 - Function split() is deprecated, %s(74)
233array(1) {
234  [0]=>
235  string(0) ""
236}
237Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
238
239Arg value
240Error: 8192 - Function split() is deprecated, %s(74)
241Error: 2 - split() expects parameter 2 to be string, object given, %s(74)
242NULL
243
244Arg value
245Error: 8192 - Function split() is deprecated, %s(74)
246array(1) {
247  [0]=>
248  string(0) ""
249}
250
251Arg value
252Error: 8192 - Function split() is deprecated, %s(74)
253array(1) {
254  [0]=>
255  string(0) ""
256}
257Done
258