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)
123
124Arg value Array
125Error: 8192 - Function eregi() is deprecated, %s(75)
126Error: 8 - Array to string conversion, %s(75)
127bool(false)
128
129Arg value Array
130Error: 8192 - Function eregi() is deprecated, %s(75)
131Error: 8 - Array to string conversion, %s(75)
132bool(false)
133
134Arg value Array
135Error: 8192 - Function eregi() is deprecated, %s(75)
136Error: 8 - Array to string conversion, %s(75)
137bool(false)
138
139Arg value Array
140Error: 8192 - Function eregi() is deprecated, %s(75)
141Error: 8 - Array to string conversion, %s(75)
142bool(false)
143
144Arg value Array
145Error: 8192 - Function eregi() is deprecated, %s(75)
146Error: 8 - Array to string conversion, %s(75)
147bool(false)
148
149Arg value
150Error: 8192 - Function eregi() is deprecated, %s(75)
151Error: 2 - eregi(): REG_EMPTY, %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 1
160Error: 8192 - Function eregi() is deprecated, %s(75)
161int(1)
162
163Arg value
164Error: 8192 - Function eregi() is deprecated, %s(75)
165Error: 2 - eregi(): REG_EMPTY, %s(75)
166bool(false)
167
168Arg value 1
169Error: 8192 - Function eregi() is deprecated, %s(75)
170int(1)
171
172Arg value
173Error: 8192 - Function eregi() is deprecated, %s(75)
174Error: 2 - eregi(): REG_EMPTY, %s(75)
175bool(false)
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)
186Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
187
188Arg value
189Error: 8192 - Function eregi() is deprecated, %s(75)
190Error: 4096 - Object of class stdClass could not be converted to string, %s(75)
191Error: 8 - Object of class stdClass to string conversion, %s(75)
192bool(false)
193
194Arg value
195Error: 8192 - Function eregi() is deprecated, %s(75)
196Error: 2 - eregi(): REG_EMPTY, %s(75)
197bool(false)
198
199Arg value
200Error: 8192 - Function eregi() is deprecated, %s(75)
201Error: 2 - eregi(): REG_EMPTY, %s(75)
202bool(false)
203Done
204