Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / ereg / tests / split_variation_001.phpt
blob9d9fc9d518bc18341eb3da670010b9ae89091a31
1 --TEST--
2 Test split() function : usage variations  - unexpected type for arg 1
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  */
11 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
12         echo "Error: $err_no - $err_msg, $filename($linenum)\n";
14 set_error_handler('test_error_handler');
16 echo "*** Testing split() : usage variations ***\n";
18 // Initialise function arguments not being substituted (if any)
19 $string = '1 a 1 Array 1 c ';
20 $limit = 5;
22 //get an unset variable
23 $unset_var = 10;
24 unset ($unset_var);
26 //array of values to iterate over
27 $values = array(
29       // int data
30       0,
31       1,
32       12345,
33       -2345,
35       // float data
36       10.5,
37       -10.5,
38       10.1234567e10,
39       10.7654321E-10,
40       .5,
42       // array data
43       array(),
44       array(0),
45       array(1),
46       array(1, 2),
47       array('color' => 'red', 'item' => 'pen'),
49       // null data
50       NULL,
51       null,
53       // boolean data
54       true,
55       false,
56       TRUE,
57       FALSE,
59       // empty data
60       "",
61       '',
63       // object data
64       new stdclass(),
66       // undefined data
67       $undefined_var,
69       // unset data
70       $unset_var,
73 // loop through each element of the array for pattern
75 foreach($values as $value) {
76       echo "\nArg value $value \n";
77       var_dump( split($value, $string, $limit) );
80 echo "Done";
82 --EXPECTF--
83 *** Testing split() : usage variations ***
84 Error: 8 - Undefined variable: undefined_var, %s(64)
85 Error: 8 - Undefined variable: unset_var, %s(67)
87 Arg value 0 
88 Error: 8192 - Function split() is deprecated, %s(74)
89 array(1) {
90   [0]=>
91   string(16) "1 a 1 Array 1 c "
94 Arg value 1 
95 Error: 8192 - Function split() is deprecated, %s(74)
96 array(4) {
97   [0]=>
98   string(0) ""
99   [1]=>
100   string(3) " a "
101   [2]=>
102   string(7) " Array "
103   [3]=>
104   string(3) " c "
107 Arg value 12345 
108 Error: 8192 - Function split() is deprecated, %s(74)
109 array(1) {
110   [0]=>
111   string(16) "1 a 1 Array 1 c "
114 Arg value -2345 
115 Error: 8192 - Function split() is deprecated, %s(74)
116 array(1) {
117   [0]=>
118   string(16) "1 a 1 Array 1 c "
121 Arg value 10.5 
122 Error: 8192 - Function split() is deprecated, %s(74)
123 array(1) {
124   [0]=>
125   string(16) "1 a 1 Array 1 c "
128 Arg value -10.5 
129 Error: 8192 - Function split() is deprecated, %s(74)
130 array(1) {
131   [0]=>
132   string(16) "1 a 1 Array 1 c "
135 Arg value 101234567000 
136 Error: 8192 - Function split() is deprecated, %s(74)
137 array(1) {
138   [0]=>
139   string(16) "1 a 1 Array 1 c "
142 Arg value 1.07654321E-9 
143 Error: 8192 - Function split() is deprecated, %s(74)
144 array(1) {
145   [0]=>
146   string(16) "1 a 1 Array 1 c "
149 Arg value 0.5 
150 Error: 8192 - Function split() is deprecated, %s(74)
151 array(1) {
152   [0]=>
153   string(16) "1 a 1 Array 1 c "
155 Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
157 Arg value Array 
158 Error: 8192 - Function split() is deprecated, %s(74)
159 Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
160 NULL
161 Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
163 Arg value Array 
164 Error: 8192 - Function split() is deprecated, %s(74)
165 Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
166 NULL
167 Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
169 Arg value Array 
170 Error: 8192 - Function split() is deprecated, %s(74)
171 Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
172 NULL
173 Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
175 Arg value Array 
176 Error: 8192 - Function split() is deprecated, %s(74)
177 Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
178 NULL
179 Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
181 Arg value Array 
182 Error: 8192 - Function split() is deprecated, %s(74)
183 Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
184 NULL
186 Arg value  
187 Error: 8192 - Function split() is deprecated, %s(74)
188 Error: 2 - split(): REG_EMPTY, %s(74)
189 bool(false)
191 Arg value  
192 Error: 8192 - Function split() is deprecated, %s(74)
193 Error: 2 - split(): REG_EMPTY, %s(74)
194 bool(false)
196 Arg value 1 
197 Error: 8192 - Function split() is deprecated, %s(74)
198 array(4) {
199   [0]=>
200   string(0) ""
201   [1]=>
202   string(3) " a "
203   [2]=>
204   string(7) " Array "
205   [3]=>
206   string(3) " c "
209 Arg value  
210 Error: 8192 - Function split() is deprecated, %s(74)
211 Error: 2 - split(): REG_EMPTY, %s(74)
212 bool(false)
214 Arg value 1 
215 Error: 8192 - Function split() is deprecated, %s(74)
216 array(4) {
217   [0]=>
218   string(0) ""
219   [1]=>
220   string(3) " a "
221   [2]=>
222   string(7) " Array "
223   [3]=>
224   string(3) " c "
227 Arg value  
228 Error: 8192 - Function split() is deprecated, %s(74)
229 Error: 2 - split(): REG_EMPTY, %s(74)
230 bool(false)
232 Arg value  
233 Error: 8192 - Function split() is deprecated, %s(74)
234 Error: 2 - split(): REG_EMPTY, %s(74)
235 bool(false)
237 Arg value  
238 Error: 8192 - Function split() is deprecated, %s(74)
239 Error: 2 - split(): REG_EMPTY, %s(74)
240 bool(false)
241 Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
243 Arg value  
244 Error: 8192 - Function split() is deprecated, %s(74)
245 Error: 2 - split() expects parameter 1 to be string, object given, %s(74)
246 NULL
248 Arg value  
249 Error: 8192 - Function split() is deprecated, %s(74)
250 Error: 2 - split(): REG_EMPTY, %s(74)
251 bool(false)
253 Arg value  
254 Error: 8192 - Function split() is deprecated, %s(74)
255 Error: 2 - split(): REG_EMPTY, %s(74)
256 bool(false)
257 Done