Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / ereg / tests / spliti_variation_003.phpt
blob3cfeaeae1a3a3aef0ad2553898025f0a280e7d27
1 --TEST--
2 Test 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  */
11 function 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         }
17 set_error_handler('test_error_handler');
18 echo "*** Testing spliti() : usage variations ***\n";
20 // Initialise function arguments not being substituted (if any)
21 $pattern = b'[[:space:]]';
22 $string = '1 2 3 4 5';
24 //get an unset variable
25 $unset_var = 10;
26 unset ($unset_var);
28 //array of values to iterate over
29 $values = array(
31       // float data
32       10.5,
33       -10.5,
34       10.7654321E-10,
35       .5,
37       // array data
38       array(),
39       array(0),
40       array(1),
41       array(1, 2),
42       array('color' => 'red', 'item' => 'pen'),
44       // null data
45       NULL,
46       null,
48       // boolean data
49       true,
50       false,
51       TRUE,
52       FALSE,
54       // empty data
55       "",
56       '',
58       // string data
59       "string",
60       'string',
62       // object data
63       new stdclass(),
65       // undefined data
66       @$undefined_var,
68       // unset data
69       @$unset_var,
72 // loop through each element of the array for limit
74 foreach($values as $value) {
75       echo "\nArg value $value \n";
76       var_dump( spliti($pattern, $string, $value) );
79 echo "Done";
81 --EXPECTF--
82 *** Testing spliti() : usage variations ***
84 Arg value 10.5 
85 Error: 8192 - Function spliti() is deprecated, %s(73)
86 array(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"
99 Arg value -10.5 
100 Error: 8192 - Function spliti() is deprecated, %s(73)
101 array(1) {
102   [0]=>
103   string(9) "1 2 3 4 5"
106 Arg value 1.07654321E-9 
107 Error: 8192 - Function spliti() is deprecated, %s(73)
108 array(1) {
109   [0]=>
110   string(9) "1 2 3 4 5"
113 Arg value 0.5 
114 Error: 8192 - Function spliti() is deprecated, %s(73)
115 array(1) {
116   [0]=>
117   string(9) "1 2 3 4 5"
119 Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
121 Arg value Array 
122 Error: 8192 - Function spliti() is deprecated, %s(73)
123 Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
124 NULL
125 Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
127 Arg value Array 
128 Error: 8192 - Function spliti() is deprecated, %s(73)
129 Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
130 NULL
131 Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
133 Arg value Array 
134 Error: 8192 - Function spliti() is deprecated, %s(73)
135 Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
136 NULL
137 Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
139 Arg value Array 
140 Error: 8192 - Function spliti() is deprecated, %s(73)
141 Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
142 NULL
143 Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
145 Arg value Array 
146 Error: 8192 - Function spliti() is deprecated, %s(73)
147 Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
148 NULL
150 Arg value  
151 Error: 8192 - Function spliti() is deprecated, %s(73)
152 array(1) {
153   [0]=>
154   string(9) "1 2 3 4 5"
157 Arg value  
158 Error: 8192 - Function spliti() is deprecated, %s(73)
159 array(1) {
160   [0]=>
161   string(9) "1 2 3 4 5"
164 Arg value 1 
165 Error: 8192 - Function spliti() is deprecated, %s(73)
166 array(1) {
167   [0]=>
168   string(9) "1 2 3 4 5"
171 Arg value  
172 Error: 8192 - Function spliti() is deprecated, %s(73)
173 array(1) {
174   [0]=>
175   string(9) "1 2 3 4 5"
178 Arg value 1 
179 Error: 8192 - Function spliti() is deprecated, %s(73)
180 array(1) {
181   [0]=>
182   string(9) "1 2 3 4 5"
185 Arg value  
186 Error: 8192 - Function spliti() is deprecated, %s(73)
187 array(1) {
188   [0]=>
189   string(9) "1 2 3 4 5"
192 Arg value  
193 Error: 8192 - Function spliti() is deprecated, %s(73)
194 Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
195 NULL
197 Arg value  
198 Error: 8192 - Function spliti() is deprecated, %s(73)
199 Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
200 NULL
202 Arg value string 
203 Error: 8192 - Function spliti() is deprecated, %s(73)
204 Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
205 NULL
207 Arg value string 
208 Error: 8192 - Function spliti() is deprecated, %s(73)
209 Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
210 NULL
211 Error: 4096 - Object of class stdClass could not be converted to string, %s(72)
213 Arg value  
214 Error: 8192 - Function spliti() is deprecated, %s(73)
215 Error: 2 - spliti() expects parameter 3 to be long, object given, %s(73)
216 NULL
218 Arg value  
219 Error: 8192 - Function spliti() is deprecated, %s(73)
220 array(1) {
221   [0]=>
222   string(9) "1 2 3 4 5"
225 Arg value  
226 Error: 8192 - Function spliti() is deprecated, %s(73)
227 array(1) {
228   [0]=>
229   string(9) "1 2 3 4 5"
231 Done