Annotation of embedaddon/php/ext/standard/tests/array/arsort_variation1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test arsort() function : usage variations - unexpected values for 'array_arg' argument
3: --FILE--
4: <?php
5: /* Prototype : bool arsort(array &array_arg [, int sort_flags])
6: * Description: Sort an array and maintain index association
7: Elements will be arranged from highest to lowest when this function has completed.
8: * Source code: ext/standard/array.c
9: */
10:
11: /*
12: * testing arsort() by providing different unexpected values for array argument with following flag values.
13: * 1. flag value as defualt
14: * 2. SORT_REGULAR - compare items normally
15: * 3. SORT_NUMERIC - compare items numerically
16: * 4. SORT_STRING - compare items as strings
17: */
18:
19: echo "*** Testing arsort() : usage variations ***\n";
20:
21: // get an unset variable
22: $unset_var = 10;
23: unset ($unset_var);
24:
25: // resource variable
26: $fp = fopen(__FILE__, "r");
27:
28: //array of values with indices to iterate over
29: $unexpected_values = array (
30:
31: // int data
32: 0 => 0,
33: 1 => 1,
34: 2 => 12345,
35: 3 => -2345,
36:
37: // float data
38: 4 => 10.5,
39: 5 => -10.5,
40: 6 => 10.5e3,
41: 7 => 10.6E-2,
42: 8 => .5,
43:
44: // null data
45: 9 => NULL,
46: 10 => null,
47:
48: // boolean data
49: 11 => true,
50: 12 => false,
51: 13 => TRUE,
52: 14 => FALSE,
53:
54: // empty data
55: 15 => "",
56: 16 => '',
57:
58: // string data
59: 17 => "string",
60: 18 => 'string',
61:
62: // object data
63: 19 => new stdclass(),
64:
65: // undefined data
66: 20 => @undefined_var,
67:
68: // unset data
69: 21 => @unset_var,
70:
71: // resource variable
72: 22 => $fp
73:
74: );
75:
76: // loop though each element of the array and check the working of arsort()
77: // when $array arugment is supplied with different values from $unexpected_values
78: echo "\n-- Testing arsort() by supplying different unexpected values for 'array' argument --\n";
79: echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n";
80:
81: $counter = 1;
82: for($index = 0; $index < count($unexpected_values); $index ++) {
83: echo "-- Iteration $counter --\n";
84: $value = $unexpected_values [$index];
85: var_dump( arsort($value) ); // expecting : bool(false)
86: var_dump( arsort($value, SORT_REGULAR) ); // expecting : bool(false)
87: var_dump( arsort($value, SORT_NUMERIC) ); // expecting : bool(false)
88: var_dump( arsort($value, SORT_STRING) ); // expecting : bool(false)
89: $counter++;
90: }
91:
92: echo "Done";
93: ?>
94: --EXPECTF--
95: *** Testing arsort() : usage variations ***
96:
97: -- Testing arsort() by supplying different unexpected values for 'array' argument --
98:
99: -- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --
100: -- Iteration 1 --
101:
102: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
103: bool(false)
104:
105: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
106: bool(false)
107:
108: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
109: bool(false)
110:
111: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
112: bool(false)
113: -- Iteration 2 --
114:
115: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
116: bool(false)
117:
118: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
119: bool(false)
120:
121: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
122: bool(false)
123:
124: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
125: bool(false)
126: -- Iteration 3 --
127:
128: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
129: bool(false)
130:
131: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
132: bool(false)
133:
134: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
135: bool(false)
136:
137: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
138: bool(false)
139: -- Iteration 4 --
140:
141: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
142: bool(false)
143:
144: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
145: bool(false)
146:
147: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
148: bool(false)
149:
150: Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
151: bool(false)
152: -- Iteration 5 --
153:
154: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
155: bool(false)
156:
157: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
158: bool(false)
159:
160: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
161: bool(false)
162:
163: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
164: bool(false)
165: -- Iteration 6 --
166:
167: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
168: bool(false)
169:
170: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
171: bool(false)
172:
173: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
174: bool(false)
175:
176: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
177: bool(false)
178: -- Iteration 7 --
179:
180: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
181: bool(false)
182:
183: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
184: bool(false)
185:
186: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
187: bool(false)
188:
189: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
190: bool(false)
191: -- Iteration 8 --
192:
193: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
194: bool(false)
195:
196: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
197: bool(false)
198:
199: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
200: bool(false)
201:
202: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
203: bool(false)
204: -- Iteration 9 --
205:
206: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
207: bool(false)
208:
209: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
210: bool(false)
211:
212: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
213: bool(false)
214:
215: Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
216: bool(false)
217: -- Iteration 10 --
218:
219: Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
220: bool(false)
221:
222: Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
223: bool(false)
224:
225: Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
226: bool(false)
227:
228: Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
229: bool(false)
230: -- Iteration 11 --
231:
232: Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
233: bool(false)
234:
235: Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
236: bool(false)
237:
238: Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
239: bool(false)
240:
241: Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
242: bool(false)
243: -- Iteration 12 --
244:
245: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
246: bool(false)
247:
248: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
249: bool(false)
250:
251: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
252: bool(false)
253:
254: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
255: bool(false)
256: -- Iteration 13 --
257:
258: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
259: bool(false)
260:
261: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
262: bool(false)
263:
264: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
265: bool(false)
266:
267: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
268: bool(false)
269: -- Iteration 14 --
270:
271: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
272: bool(false)
273:
274: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
275: bool(false)
276:
277: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
278: bool(false)
279:
280: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
281: bool(false)
282: -- Iteration 15 --
283:
284: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
285: bool(false)
286:
287: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
288: bool(false)
289:
290: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
291: bool(false)
292:
293: Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
294: bool(false)
295: -- Iteration 16 --
296:
297: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
298: bool(false)
299:
300: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
301: bool(false)
302:
303: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
304: bool(false)
305:
306: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
307: bool(false)
308: -- Iteration 17 --
309:
310: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
311: bool(false)
312:
313: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
314: bool(false)
315:
316: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
317: bool(false)
318:
319: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
320: bool(false)
321: -- Iteration 18 --
322:
323: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
324: bool(false)
325:
326: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
327: bool(false)
328:
329: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
330: bool(false)
331:
332: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
333: bool(false)
334: -- Iteration 19 --
335:
336: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
337: bool(false)
338:
339: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
340: bool(false)
341:
342: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
343: bool(false)
344:
345: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
346: bool(false)
347: -- Iteration 20 --
348:
349: Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
350: bool(false)
351:
352: Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
353: bool(false)
354:
355: Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
356: bool(false)
357:
358: Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
359: bool(false)
360: -- Iteration 21 --
361:
362: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
363: bool(false)
364:
365: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
366: bool(false)
367:
368: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
369: bool(false)
370:
371: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
372: bool(false)
373: -- Iteration 22 --
374:
375: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
376: bool(false)
377:
378: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
379: bool(false)
380:
381: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
382: bool(false)
383:
384: Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
385: bool(false)
386: -- Iteration 23 --
387:
388: Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
389: bool(false)
390:
391: Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
392: bool(false)
393:
394: Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
395: bool(false)
396:
397: Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
398: bool(false)
399: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>