Annotation of embedaddon/php/ext/ereg/tests/split_variation_002.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test split() function : usage variations - unexpected type for arg 2
3: --FILE--
4: <?php
5: /* Prototype : proto array split(string pattern, string string [, int limit])
6: * Description: Split string into array by regular expression
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 split() : usage variations ***\n";
17:
18: // Initialise function arguments not being substituted (if any)
19: $pattern = 'r|j|E';
20: $limit = 5;
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: // array data
43: array(),
44: array(0),
45: array(1),
46: array(1, 2),
47: array('color' => 'red', 'item' => 'pen'),
48:
49: // null data
50: NULL,
51: null,
52:
53: // boolean data
54: true,
55: false,
56: TRUE,
57: FALSE,
58:
59: // empty data
60: "",
61: '',
62:
63: // object data
64: new stdclass(),
65:
66: // undefined data
67: $undefined_var,
68:
69: // unset data
70: $unset_var,
71: );
72:
73: // loop through each element of the array for string
74:
75: foreach($values as $value) {
76: echo "\nArg value $value \n";
77: var_dump( split($pattern, $value, $limit) );
78: };
79:
80: echo "Done";
81: ?>
82: --EXPECTF--
83: *** Testing split() : usage variations ***
84: Error: 8 - Undefined variable: undefined_var, %s(64)
85: Error: 8 - Undefined variable: unset_var, %s(67)
86:
87: Arg value 0
88: Error: 8192 - Function split() is deprecated, %s(74)
89: array(1) {
90: [0]=>
91: string(1) "0"
92: }
93:
94: Arg value 1
95: Error: 8192 - Function split() is deprecated, %s(74)
96: array(1) {
97: [0]=>
98: string(1) "1"
99: }
100:
101: Arg value 12345
102: Error: 8192 - Function split() is deprecated, %s(74)
103: array(1) {
104: [0]=>
105: string(5) "12345"
106: }
107:
108: Arg value -2345
109: Error: 8192 - Function split() is deprecated, %s(74)
110: array(1) {
111: [0]=>
112: string(5) "-2345"
113: }
114:
115: Arg value 10.5
116: Error: 8192 - Function split() is deprecated, %s(74)
117: array(1) {
118: [0]=>
119: string(4) "10.5"
120: }
121:
122: Arg value -10.5
123: Error: 8192 - Function split() is deprecated, %s(74)
124: array(1) {
125: [0]=>
126: string(5) "-10.5"
127: }
128:
129: Arg value 101234567000
130: Error: 8192 - Function split() is deprecated, %s(74)
131: array(1) {
132: [0]=>
133: string(12) "101234567000"
134: }
135:
136: Arg value 1.07654321E-9
137: Error: 8192 - Function split() is deprecated, %s(74)
138: array(2) {
139: [0]=>
140: string(10) "1.07654321"
141: [1]=>
142: string(2) "-9"
143: }
144:
145: Arg value 0.5
146: Error: 8192 - Function split() is deprecated, %s(74)
147: array(1) {
148: [0]=>
149: string(3) "0.5"
150: }
151:
152: Arg value Array
153: Error: 8192 - Function split() is deprecated, %s(74)
154: Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
155: NULL
156:
157: Arg value Array
158: Error: 8192 - Function split() is deprecated, %s(74)
159: Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
160: NULL
161:
162: Arg value Array
163: Error: 8192 - Function split() is deprecated, %s(74)
164: Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
165: NULL
166:
167: Arg value Array
168: Error: 8192 - Function split() is deprecated, %s(74)
169: Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
170: NULL
171:
172: Arg value Array
173: Error: 8192 - Function split() is deprecated, %s(74)
174: Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
175: NULL
176:
177: Arg value
178: Error: 8192 - Function split() is deprecated, %s(74)
179: array(1) {
180: [0]=>
181: string(0) ""
182: }
183:
184: Arg value
185: Error: 8192 - Function split() is deprecated, %s(74)
186: array(1) {
187: [0]=>
188: string(0) ""
189: }
190:
191: Arg value 1
192: Error: 8192 - Function split() is deprecated, %s(74)
193: array(1) {
194: [0]=>
195: string(1) "1"
196: }
197:
198: Arg value
199: Error: 8192 - Function split() is deprecated, %s(74)
200: array(1) {
201: [0]=>
202: string(0) ""
203: }
204:
205: Arg value 1
206: Error: 8192 - Function split() is deprecated, %s(74)
207: array(1) {
208: [0]=>
209: string(1) "1"
210: }
211:
212: Arg value
213: Error: 8192 - Function split() is deprecated, %s(74)
214: array(1) {
215: [0]=>
216: string(0) ""
217: }
218:
219: Arg value
220: Error: 8192 - Function split() is deprecated, %s(74)
221: array(1) {
222: [0]=>
223: string(0) ""
224: }
225:
226: Arg value
227: Error: 8192 - Function split() is deprecated, %s(74)
228: array(1) {
229: [0]=>
230: string(0) ""
231: }
232: Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
233:
234: Arg value
235: Error: 8192 - Function split() is deprecated, %s(74)
236: Error: 2 - split() expects parameter 2 to be string, object given, %s(74)
237: NULL
238:
239: Arg value
240: Error: 8192 - Function split() is deprecated, %s(74)
241: array(1) {
242: [0]=>
243: string(0) ""
244: }
245:
246: Arg value
247: Error: 8192 - Function split() is deprecated, %s(74)
248: array(1) {
249: [0]=>
250: string(0) ""
251: }
252: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>