Annotation of embedaddon/php/ext/ereg/tests/eregi_variation_003.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test eregi() function : usage variations - unexpected type for arg 3
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:
11: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
12: echo "Error: $err_no - $err_msg, $filename($linenum)\n";
13: }
14: set_error_handler('test_error_handler');
15:
16: echo "*** Testing eregi() : usage variations ***\n";
17:
18: // Initialise function arguments not being substituted (if any)
19: $pattern = 'h(.*)lo!';
20: $string = 'hello!';
21:
22: //get an unset variable
23: $unset_var = 10;
24: unset ($unset_var);
25:
26: //array of values to iterate over
27: $values = array(
28:
29: // int data
30: 0,
31: 1,
32: 12345,
33: -2345,
34:
35: // float data
36: 10.5,
37: -10.5,
38: 10.1234567e10,
39: 10.7654321E-10,
40: .5,
41:
42: // null data
43: NULL,
44: null,
45:
46: // boolean data
47: true,
48: false,
49: TRUE,
50: FALSE,
51:
52: // empty data
53: "",
54: '',
55:
56: // string data
57: "string",
58: 'string',
59:
60: // object data
61: new stdclass(),
62:
63: // undefined data
64: $undefined_var,
65:
66: // unset data
67: $unset_var,
68: );
69:
70: // loop through each element of the array for registers
71:
72: foreach($values as $value) {
73: echo "\nArg value $value \n";
74: var_dump( eregi($pattern, $string, $value) );
75: var_dump($value);
76: };
77:
78: echo "Done";
79: ?>
80: --EXPECTF--
81: *** Testing eregi() : usage variations ***
82: Error: 8 - Undefined variable: undefined_var, %s(61)
83: Error: 8 - Undefined variable: unset_var, %s(64)
84:
85: Arg value 0
86: Error: 8192 - Function eregi() is deprecated, %s(71)
87: int(6)
88: array(2) {
89: [0]=>
90: string(6) "hello!"
91: [1]=>
92: string(2) "el"
93: }
94:
95: Arg value 1
96: Error: 8192 - Function eregi() is deprecated, %s(71)
97: int(6)
98: array(2) {
99: [0]=>
100: string(6) "hello!"
101: [1]=>
102: string(2) "el"
103: }
104:
105: Arg value 12345
106: Error: 8192 - Function eregi() is deprecated, %s(71)
107: int(6)
108: array(2) {
109: [0]=>
110: string(6) "hello!"
111: [1]=>
112: string(2) "el"
113: }
114:
115: Arg value -2345
116: Error: 8192 - Function eregi() is deprecated, %s(71)
117: int(6)
118: array(2) {
119: [0]=>
120: string(6) "hello!"
121: [1]=>
122: string(2) "el"
123: }
124:
125: Arg value 10.5
126: Error: 8192 - Function eregi() is deprecated, %s(71)
127: int(6)
128: array(2) {
129: [0]=>
130: string(6) "hello!"
131: [1]=>
132: string(2) "el"
133: }
134:
135: Arg value -10.5
136: Error: 8192 - Function eregi() is deprecated, %s(71)
137: int(6)
138: array(2) {
139: [0]=>
140: string(6) "hello!"
141: [1]=>
142: string(2) "el"
143: }
144:
145: Arg value 101234567000
146: Error: 8192 - Function eregi() is deprecated, %s(71)
147: int(6)
148: array(2) {
149: [0]=>
150: string(6) "hello!"
151: [1]=>
152: string(2) "el"
153: }
154:
155: Arg value 1.07654321E-9
156: Error: 8192 - Function eregi() is deprecated, %s(71)
157: int(6)
158: array(2) {
159: [0]=>
160: string(6) "hello!"
161: [1]=>
162: string(2) "el"
163: }
164:
165: Arg value 0.5
166: Error: 8192 - Function eregi() is deprecated, %s(71)
167: int(6)
168: array(2) {
169: [0]=>
170: string(6) "hello!"
171: [1]=>
172: string(2) "el"
173: }
174:
175: Arg value
176: Error: 8192 - Function eregi() is deprecated, %s(71)
177: int(6)
178: array(2) {
179: [0]=>
180: string(6) "hello!"
181: [1]=>
182: string(2) "el"
183: }
184:
185: Arg value
186: Error: 8192 - Function eregi() is deprecated, %s(71)
187: int(6)
188: array(2) {
189: [0]=>
190: string(6) "hello!"
191: [1]=>
192: string(2) "el"
193: }
194:
195: Arg value 1
196: Error: 8192 - Function eregi() is deprecated, %s(71)
197: int(6)
198: array(2) {
199: [0]=>
200: string(6) "hello!"
201: [1]=>
202: string(2) "el"
203: }
204:
205: Arg value
206: Error: 8192 - Function eregi() is deprecated, %s(71)
207: int(6)
208: array(2) {
209: [0]=>
210: string(6) "hello!"
211: [1]=>
212: string(2) "el"
213: }
214:
215: Arg value 1
216: Error: 8192 - Function eregi() is deprecated, %s(71)
217: int(6)
218: array(2) {
219: [0]=>
220: string(6) "hello!"
221: [1]=>
222: string(2) "el"
223: }
224:
225: Arg value
226: Error: 8192 - Function eregi() is deprecated, %s(71)
227: int(6)
228: array(2) {
229: [0]=>
230: string(6) "hello!"
231: [1]=>
232: string(2) "el"
233: }
234:
235: Arg value
236: Error: 8192 - Function eregi() is deprecated, %s(71)
237: int(6)
238: array(2) {
239: [0]=>
240: string(6) "hello!"
241: [1]=>
242: string(2) "el"
243: }
244:
245: Arg value
246: Error: 8192 - Function eregi() is deprecated, %s(71)
247: int(6)
248: array(2) {
249: [0]=>
250: string(6) "hello!"
251: [1]=>
252: string(2) "el"
253: }
254:
255: Arg value string
256: Error: 8192 - Function eregi() is deprecated, %s(71)
257: int(6)
258: array(2) {
259: [0]=>
260: string(6) "hello!"
261: [1]=>
262: string(2) "el"
263: }
264:
265: Arg value string
266: Error: 8192 - Function eregi() is deprecated, %s(71)
267: int(6)
268: array(2) {
269: [0]=>
270: string(6) "hello!"
271: [1]=>
272: string(2) "el"
273: }
274: Error: 4096 - Object of class stdClass could not be converted to string, %s(70)
275:
276: Arg value
277: Error: 8192 - Function eregi() is deprecated, %s(71)
278: int(6)
279: array(2) {
280: [0]=>
281: string(6) "hello!"
282: [1]=>
283: string(2) "el"
284: }
285:
286: Arg value
287: Error: 8192 - Function eregi() is deprecated, %s(71)
288: int(6)
289: array(2) {
290: [0]=>
291: string(6) "hello!"
292: [1]=>
293: string(2) "el"
294: }
295:
296: Arg value
297: Error: 8192 - Function eregi() is deprecated, %s(71)
298: int(6)
299: array(2) {
300: [0]=>
301: string(6) "hello!"
302: [1]=>
303: string(2) "el"
304: }
305: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>