1--TEST--
2Test eregi() function : usage variations  - unexpected type arg 1
3--FILE--
4<?php
5/* Prototype  : proto int eregi(string pattern, string string [, array registers])
6 * Description: Regular expression match
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
16
17echo "*** Testing eregi() : usage variations ***\n";
18
19// Initialise function arguments not being substituted (if any)
20$string = '1';
21$registers = array(1, 2);
22
23//get an unset variable
24$unset_var = 10;
25unset ($unset_var);
26
27//array of values to iterate over
28$values = array(
29
30      // int data
31      0,
32      1,
33      12345,
34      -2345,
35
36      // float data
37      10.5,
38      -10.5,
39      10.1234567e10,
40      10.7654321E-10,
41      .5,
42
43      // array data
44      array(),
45      array(0),
46      array(1),
47      array(1, 2),
48      array('color' => 'red', 'item' => 'pen'),
49
50      // null data
51      NULL,
52      null,
53
54      // boolean data
55      true,
56      false,
57      TRUE,
58      FALSE,
59
60      // empty data
61      "",
62      '',
63
64      // object data
65      new stdclass(),
66
67      // undefined data
68      $undefined_var,
69
70      // unset data
71      $unset_var,
72);
73
74// loop through each element of the array for pattern
75
76foreach($values as $value) {
77      echo "\nArg value $value \n";
78      var_dump( eregi($value, $string, $registers) );
79};
80
81echo "Done";
82?>
83--EXPECTF--
84*** Testing eregi() : usage variations ***
85Error: 8 - Undefined variable: undefined_var, %s(65)
86Error: 8 - Undefined variable: unset_var, %s(68)
87
88Arg value 0
89Error: 8192 - Function eregi() is deprecated, %s(75)
90bool(false)
91
92Arg value 1
93Error: 8192 - Function eregi() is deprecated, %s(75)
94int(1)
95
96Arg value 12345
97Error: 8192 - Function eregi() is deprecated, %s(75)
98bool(false)
99
100Arg value -2345
101Error: 8192 - Function eregi() is deprecated, %s(75)
102bool(false)
103
104Arg value 10.5
105Error: 8192 - Function eregi() is deprecated, %s(75)
106bool(false)
107
108Arg value -10.5
109Error: 8192 - Function eregi() is deprecated, %s(75)
110bool(false)
111
112Arg value 101234567000
113Error: 8192 - Function eregi() is deprecated, %s(75)
114bool(false)
115
116Arg value 1.07654321E-9
117Error: 8192 - Function eregi() is deprecated, %s(75)
118bool(false)
119
120Arg value 0.5
121Error: 8192 - Function eregi() is deprecated, %s(75)
122bool(false)
123Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
124
125Arg value Array
126Error: 8192 - Function eregi() is deprecated, %s(75)
127Error: 8 - Array to string conversion, %s(75)
128bool(false)
129Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
130
131Arg value Array
132Error: 8192 - Function eregi() is deprecated, %s(75)
133Error: 8 - Array to string conversion, %s(75)
134bool(false)
135Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
136
137Arg value Array
138Error: 8192 - Function eregi() is deprecated, %s(75)
139Error: 8 - Array to string conversion, %s(75)
140bool(false)
141Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
142
143Arg value Array
144Error: 8192 - Function eregi() is deprecated, %s(75)
145Error: 8 - Array to string conversion, %s(75)
146bool(false)
147Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
148
149Arg value Array
150Error: 8192 - Function eregi() is deprecated, %s(75)
151Error: 8 - Array to string conversion, %s(75)
152bool(false)
153
154Arg value
155Error: 8192 - Function eregi() is deprecated, %s(75)
156Error: 2 - eregi(): REG_EMPTY, %s(75)
157bool(false)
158
159Arg value
160Error: 8192 - Function eregi() is deprecated, %s(75)
161Error: 2 - eregi(): REG_EMPTY, %s(75)
162bool(false)
163
164Arg value 1
165Error: 8192 - Function eregi() is deprecated, %s(75)
166int(1)
167
168Arg value
169Error: 8192 - Function eregi() is deprecated, %s(75)
170Error: 2 - eregi(): REG_EMPTY, %s(75)
171bool(false)
172
173Arg value 1
174Error: 8192 - Function eregi() is deprecated, %s(75)
175int(1)
176
177Arg value
178Error: 8192 - Function eregi() is deprecated, %s(75)
179Error: 2 - eregi(): REG_EMPTY, %s(75)
180bool(false)
181
182Arg value
183Error: 8192 - Function eregi() is deprecated, %s(75)
184Error: 2 - eregi(): REG_EMPTY, %s(75)
185bool(false)
186
187Arg value
188Error: 8192 - Function eregi() is deprecated, %s(75)
189Error: 2 - eregi(): REG_EMPTY, %s(75)
190bool(false)
191Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
192
193Arg value
194Error: 8192 - Function eregi() is deprecated, %s(75)
195Error: 4096 - Object of class stdClass could not be converted to string, %s(75)
196Error: 8 - Object of class stdClass to string conversion, %s(75)
197bool(false)
198
199Arg value
200Error: 8192 - Function eregi() is deprecated, %s(75)
201Error: 2 - eregi(): REG_EMPTY, %s(75)
202bool(false)
203
204Arg value
205Error: 8192 - Function eregi() is deprecated, %s(75)
206Error: 2 - eregi(): REG_EMPTY, %s(75)
207bool(false)
208Done
209