Annotation of embedaddon/php/ext/ereg/tests/spliti_variation_001.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test spliti() function : usage variations - unexpected type for arg 1
3: --FILE--
4: <?php
5: /* Prototype : proto array spliti(string pattern, string string [, int limit])
6: * Description: spliti 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 spliti() : usage variations ***\n";
17:
18: // Initialise function arguments not being substituted (if any)
19: $string = '1 a 1 Array 1 c ';
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 pattern
74:
75: foreach($values as $value) {
76: echo "\nArg value $value \n";
77: var_dump( spliti($value, $string, $limit) );
78: };
79:
80: echo "Done";
81: ?>
82: --EXPECTF--
83: *** Testing spliti() : 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 spliti() is deprecated, %s(74)
89: array(1) {
90: [0]=>
91: string(16) "1 a 1 Array 1 c "
92: }
93:
94: Arg value 1
95: Error: 8192 - Function spliti() is deprecated, %s(74)
96: array(4) {
97: [0]=>
98: string(0) ""
99: [1]=>
100: string(3) " a "
101: [2]=>
102: string(7) " Array "
103: [3]=>
104: string(3) " c "
105: }
106:
107: Arg value 12345
108: Error: 8192 - Function spliti() is deprecated, %s(74)
109: array(1) {
110: [0]=>
111: string(16) "1 a 1 Array 1 c "
112: }
113:
114: Arg value -2345
115: Error: 8192 - Function spliti() is deprecated, %s(74)
116: array(1) {
117: [0]=>
118: string(16) "1 a 1 Array 1 c "
119: }
120:
121: Arg value 10.5
122: Error: 8192 - Function spliti() is deprecated, %s(74)
123: array(1) {
124: [0]=>
125: string(16) "1 a 1 Array 1 c "
126: }
127:
128: Arg value -10.5
129: Error: 8192 - Function spliti() is deprecated, %s(74)
130: array(1) {
131: [0]=>
132: string(16) "1 a 1 Array 1 c "
133: }
134:
135: Arg value 101234567000
136: Error: 8192 - Function spliti() is deprecated, %s(74)
137: array(1) {
138: [0]=>
139: string(16) "1 a 1 Array 1 c "
140: }
141:
142: Arg value 1.07654321E-9
143: Error: 8192 - Function spliti() is deprecated, %s(74)
144: array(1) {
145: [0]=>
146: string(16) "1 a 1 Array 1 c "
147: }
148:
149: Arg value 0.5
150: Error: 8192 - Function spliti() is deprecated, %s(74)
151: array(1) {
152: [0]=>
153: string(16) "1 a 1 Array 1 c "
154: }
155:
156: Arg value Array
157: Error: 8192 - Function spliti() is deprecated, %s(74)
158: Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
159: NULL
160:
161: Arg value Array
162: Error: 8192 - Function spliti() is deprecated, %s(74)
163: Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
164: NULL
165:
166: Arg value Array
167: Error: 8192 - Function spliti() is deprecated, %s(74)
168: Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
169: NULL
170:
171: Arg value Array
172: Error: 8192 - Function spliti() is deprecated, %s(74)
173: Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
174: NULL
175:
176: Arg value Array
177: Error: 8192 - Function spliti() is deprecated, %s(74)
178: Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
179: NULL
180:
181: Arg value
182: Error: 8192 - Function spliti() is deprecated, %s(74)
183: Error: 2 - spliti(): REG_EMPTY, %s(74)
184: bool(false)
185:
186: Arg value
187: Error: 8192 - Function spliti() is deprecated, %s(74)
188: Error: 2 - spliti(): REG_EMPTY, %s(74)
189: bool(false)
190:
191: Arg value 1
192: Error: 8192 - Function spliti() is deprecated, %s(74)
193: array(4) {
194: [0]=>
195: string(0) ""
196: [1]=>
197: string(3) " a "
198: [2]=>
199: string(7) " Array "
200: [3]=>
201: string(3) " c "
202: }
203:
204: Arg value
205: Error: 8192 - Function spliti() is deprecated, %s(74)
206: Error: 2 - spliti(): REG_EMPTY, %s(74)
207: bool(false)
208:
209: Arg value 1
210: Error: 8192 - Function spliti() is deprecated, %s(74)
211: array(4) {
212: [0]=>
213: string(0) ""
214: [1]=>
215: string(3) " a "
216: [2]=>
217: string(7) " Array "
218: [3]=>
219: string(3) " c "
220: }
221:
222: Arg value
223: Error: 8192 - Function spliti() is deprecated, %s(74)
224: Error: 2 - spliti(): REG_EMPTY, %s(74)
225: bool(false)
226:
227: Arg value
228: Error: 8192 - Function spliti() is deprecated, %s(74)
229: Error: 2 - spliti(): REG_EMPTY, %s(74)
230: bool(false)
231:
232: Arg value
233: Error: 8192 - Function spliti() is deprecated, %s(74)
234: Error: 2 - spliti(): REG_EMPTY, %s(74)
235: bool(false)
236: Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
237:
238: Arg value
239: Error: 8192 - Function spliti() is deprecated, %s(74)
240: Error: 2 - spliti() expects parameter 1 to be string, object given, %s(74)
241: NULL
242:
243: Arg value
244: Error: 8192 - Function spliti() is deprecated, %s(74)
245: Error: 2 - spliti(): REG_EMPTY, %s(74)
246: bool(false)
247:
248: Arg value
249: Error: 8192 - Function spliti() is deprecated, %s(74)
250: Error: 2 - spliti(): REG_EMPTY, %s(74)
251: bool(false)
252: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>