Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / ereg / tests / ereg_variation_003.phpt
blobbf898d908f2590d4bcfd5af0ede4836d3b132c7b
1 --TEST--
2 Test ereg() function : usage variations  - unexpected type for arg 3
3 --FILE--
4 <?php
5 /* Prototype  : proto int ereg(string pattern, string string [, array registers])
6  * Description: Regular expression match 
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 ereg() : usage variations ***\n";
18 // Initialise function arguments not being substituted (if any)
19 $pattern = 'h(.*)lo!';
20 $string = 'hello!';
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       // null data
43       NULL,
44       null,
46       // boolean data
47       true,
48       false,
49       TRUE,
50       FALSE,
52       // empty data
53       "",
54       '',
56       // string data
57       "string",
58       'string',
60       // object data
61       new stdclass(),
63       // undefined data
64       $undefined_var,
66       // unset data
67       $unset_var,
70 // loop through each element of the array for registers
72 foreach($values as $value) {
73       echo "\nArg value $value \n";
74       var_dump( ereg($pattern, $string, $value) );
75       var_dump($value);
78 echo "Done";
80 --EXPECTF--
81 *** Testing ereg() : usage variations ***
82 Error: 8 - Undefined variable: undefined_var, %s(61)
83 Error: 8 - Undefined variable: unset_var, %s(64)
85 Arg value 0 
86 Error: 8192 - Function ereg() is deprecated, %s(71)
87 int(6)
88 array(2) {
89   [0]=>
90   string(6) "hello!"
91   [1]=>
92   string(2) "el"
95 Arg value 1 
96 Error: 8192 - Function ereg() is deprecated, %s(71)
97 int(6)
98 array(2) {
99   [0]=>
100   string(6) "hello!"
101   [1]=>
102   string(2) "el"
105 Arg value 12345 
106 Error: 8192 - Function ereg() is deprecated, %s(71)
107 int(6)
108 array(2) {
109   [0]=>
110   string(6) "hello!"
111   [1]=>
112   string(2) "el"
115 Arg value -2345 
116 Error: 8192 - Function ereg() is deprecated, %s(71)
117 int(6)
118 array(2) {
119   [0]=>
120   string(6) "hello!"
121   [1]=>
122   string(2) "el"
125 Arg value 10.5 
126 Error: 8192 - Function ereg() is deprecated, %s(71)
127 int(6)
128 array(2) {
129   [0]=>
130   string(6) "hello!"
131   [1]=>
132   string(2) "el"
135 Arg value -10.5 
136 Error: 8192 - Function ereg() is deprecated, %s(71)
137 int(6)
138 array(2) {
139   [0]=>
140   string(6) "hello!"
141   [1]=>
142   string(2) "el"
145 Arg value 101234567000 
146 Error: 8192 - Function ereg() is deprecated, %s(71)
147 int(6)
148 array(2) {
149   [0]=>
150   string(6) "hello!"
151   [1]=>
152   string(2) "el"
155 Arg value 1.07654321E-9 
156 Error: 8192 - Function ereg() is deprecated, %s(71)
157 int(6)
158 array(2) {
159   [0]=>
160   string(6) "hello!"
161   [1]=>
162   string(2) "el"
165 Arg value 0.5 
166 Error: 8192 - Function ereg() is deprecated, %s(71)
167 int(6)
168 array(2) {
169   [0]=>
170   string(6) "hello!"
171   [1]=>
172   string(2) "el"
175 Arg value  
176 Error: 8192 - Function ereg() is deprecated, %s(71)
177 int(6)
178 array(2) {
179   [0]=>
180   string(6) "hello!"
181   [1]=>
182   string(2) "el"
185 Arg value  
186 Error: 8192 - Function ereg() is deprecated, %s(71)
187 int(6)
188 array(2) {
189   [0]=>
190   string(6) "hello!"
191   [1]=>
192   string(2) "el"
195 Arg value 1 
196 Error: 8192 - Function ereg() is deprecated, %s(71)
197 int(6)
198 array(2) {
199   [0]=>
200   string(6) "hello!"
201   [1]=>
202   string(2) "el"
205 Arg value  
206 Error: 8192 - Function ereg() is deprecated, %s(71)
207 int(6)
208 array(2) {
209   [0]=>
210   string(6) "hello!"
211   [1]=>
212   string(2) "el"
215 Arg value 1 
216 Error: 8192 - Function ereg() is deprecated, %s(71)
217 int(6)
218 array(2) {
219   [0]=>
220   string(6) "hello!"
221   [1]=>
222   string(2) "el"
225 Arg value  
226 Error: 8192 - Function ereg() is deprecated, %s(71)
227 int(6)
228 array(2) {
229   [0]=>
230   string(6) "hello!"
231   [1]=>
232   string(2) "el"
235 Arg value  
236 Error: 8192 - Function ereg() is deprecated, %s(71)
237 int(6)
238 array(2) {
239   [0]=>
240   string(6) "hello!"
241   [1]=>
242   string(2) "el"
245 Arg value  
246 Error: 8192 - Function ereg() is deprecated, %s(71)
247 int(6)
248 array(2) {
249   [0]=>
250   string(6) "hello!"
251   [1]=>
252   string(2) "el"
255 Arg value string 
256 Error: 8192 - Function ereg() is deprecated, %s(71)
257 int(6)
258 array(2) {
259   [0]=>
260   string(6) "hello!"
261   [1]=>
262   string(2) "el"
265 Arg value string 
266 Error: 8192 - Function ereg() is deprecated, %s(71)
267 int(6)
268 array(2) {
269   [0]=>
270   string(6) "hello!"
271   [1]=>
272   string(2) "el"
274 Error: 4096 - Object of class stdClass could not be converted to string, %s(70)
276 Arg value  
277 Error: 8192 - Function ereg() is deprecated, %s(71)
278 int(6)
279 array(2) {
280   [0]=>
281   string(6) "hello!"
282   [1]=>
283   string(2) "el"
286 Arg value  
287 Error: 8192 - Function ereg() is deprecated, %s(71)
288 int(6)
289 array(2) {
290   [0]=>
291   string(6) "hello!"
292   [1]=>
293   string(2) "el"
296 Arg value  
297 Error: 8192 - Function ereg() is deprecated, %s(71)
298 int(6)
299 array(2) {
300   [0]=>
301   string(6) "hello!"
302   [1]=>
303   string(2) "el"
305 Done