Annotation of embedaddon/php/ext/ereg/tests/spliti_variation_003.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test spliti() function : usage variations - unexpected type for arg 3
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: if (error_reporting() != 0) {
13: // report non-silenced errors
14: echo "Error: $err_no - $err_msg, $filename($linenum)\n";
15: }
16: }
17: set_error_handler('test_error_handler');
18: echo "*** Testing spliti() : usage variations ***\n";
19:
20: // Initialise function arguments not being substituted (if any)
21: $pattern = b'[[:space:]]';
22: $string = '1 2 3 4 5';
23:
24: //get an unset variable
25: $unset_var = 10;
26: unset ($unset_var);
27:
28: //array of values to iterate over
29: $values = array(
30:
31: // float data
32: 10.5,
33: -10.5,
34: 10.7654321E-10,
35: .5,
36:
37: // array data
38: array(),
39: array(0),
40: array(1),
41: array(1, 2),
42: array('color' => 'red', 'item' => 'pen'),
43:
44: // null data
45: NULL,
46: null,
47:
48: // boolean data
49: true,
50: false,
51: TRUE,
52: FALSE,
53:
54: // empty data
55: "",
56: '',
57:
58: // string data
59: "string",
60: 'string',
61:
62: // object data
63: new stdclass(),
64:
65: // undefined data
66: @$undefined_var,
67:
68: // unset data
69: @$unset_var,
70: );
71:
72: // loop through each element of the array for limit
73:
74: foreach($values as $value) {
75: echo "\nArg value $value \n";
76: var_dump( spliti($pattern, $string, $value) );
77: };
78:
79: echo "Done";
80: ?>
81: --EXPECTF--
82: *** Testing spliti() : usage variations ***
83:
84: Arg value 10.5
85: Error: 8192 - Function spliti() is deprecated, %s(73)
86: array(5) {
87: [0]=>
88: string(1) "1"
89: [1]=>
90: string(1) "2"
91: [2]=>
92: string(1) "3"
93: [3]=>
94: string(1) "4"
95: [4]=>
96: string(1) "5"
97: }
98:
99: Arg value -10.5
100: Error: 8192 - Function spliti() is deprecated, %s(73)
101: array(1) {
102: [0]=>
103: string(9) "1 2 3 4 5"
104: }
105:
106: Arg value 1.07654321E-9
107: Error: 8192 - Function spliti() is deprecated, %s(73)
108: array(1) {
109: [0]=>
110: string(9) "1 2 3 4 5"
111: }
112:
113: Arg value 0.5
114: Error: 8192 - Function spliti() is deprecated, %s(73)
115: array(1) {
116: [0]=>
117: string(9) "1 2 3 4 5"
118: }
1.1.1.2 ! misho 119: Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
1.1 misho 120:
121: Arg value Array
122: Error: 8192 - Function spliti() is deprecated, %s(73)
123: Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
124: NULL
1.1.1.2 ! misho 125: Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
1.1 misho 126:
127: Arg value Array
128: Error: 8192 - Function spliti() is deprecated, %s(73)
129: Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
130: NULL
1.1.1.2 ! misho 131: Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
1.1 misho 132:
133: Arg value Array
134: Error: 8192 - Function spliti() is deprecated, %s(73)
135: Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
136: NULL
1.1.1.2 ! misho 137: Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
1.1 misho 138:
139: Arg value Array
140: Error: 8192 - Function spliti() is deprecated, %s(73)
141: Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
142: NULL
1.1.1.2 ! misho 143: Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
1.1 misho 144:
145: Arg value Array
146: Error: 8192 - Function spliti() is deprecated, %s(73)
147: Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
148: NULL
149:
150: Arg value
151: Error: 8192 - Function spliti() is deprecated, %s(73)
152: array(1) {
153: [0]=>
154: string(9) "1 2 3 4 5"
155: }
156:
157: Arg value
158: Error: 8192 - Function spliti() is deprecated, %s(73)
159: array(1) {
160: [0]=>
161: string(9) "1 2 3 4 5"
162: }
163:
164: Arg value 1
165: Error: 8192 - Function spliti() is deprecated, %s(73)
166: array(1) {
167: [0]=>
168: string(9) "1 2 3 4 5"
169: }
170:
171: Arg value
172: Error: 8192 - Function spliti() is deprecated, %s(73)
173: array(1) {
174: [0]=>
175: string(9) "1 2 3 4 5"
176: }
177:
178: Arg value 1
179: Error: 8192 - Function spliti() is deprecated, %s(73)
180: array(1) {
181: [0]=>
182: string(9) "1 2 3 4 5"
183: }
184:
185: Arg value
186: Error: 8192 - Function spliti() is deprecated, %s(73)
187: array(1) {
188: [0]=>
189: string(9) "1 2 3 4 5"
190: }
191:
192: Arg value
193: Error: 8192 - Function spliti() is deprecated, %s(73)
194: Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
195: NULL
196:
197: Arg value
198: Error: 8192 - Function spliti() is deprecated, %s(73)
199: Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
200: NULL
201:
202: Arg value string
203: Error: 8192 - Function spliti() is deprecated, %s(73)
204: Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
205: NULL
206:
207: Arg value string
208: Error: 8192 - Function spliti() is deprecated, %s(73)
209: Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
210: NULL
211: Error: 4096 - Object of class stdClass could not be converted to string, %s(72)
212:
213: Arg value
214: Error: 8192 - Function spliti() is deprecated, %s(73)
215: Error: 2 - spliti() expects parameter 3 to be long, object given, %s(73)
216: NULL
217:
218: Arg value
219: Error: 8192 - Function spliti() is deprecated, %s(73)
220: array(1) {
221: [0]=>
222: string(9) "1 2 3 4 5"
223: }
224:
225: Arg value
226: Error: 8192 - Function spliti() is deprecated, %s(73)
227: array(1) {
228: [0]=>
229: string(9) "1 2 3 4 5"
230: }
231: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>