Annotation of embedaddon/php/tests/lang/foreachLoop.003.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Foreach loop tests - error case: not an array.
3: --FILE--
4: <?php
5: echo "\nNot an array.\n";
6: $a = TRUE;
7: foreach ($a as $v) {
8: var_dump($v);
9: }
10:
11: $a = null;
12: foreach ($a as $v) {
13: var_dump($v);
14: }
15:
16: $a = 1;
17: foreach ($a as $v) {
18: var_dump($v);
19: }
20:
21: $a = 1.5;
22: foreach ($a as $v) {
23: var_dump($v);
24: }
25:
26: $a = "hello";
27: foreach ($a as $v) {
28: var_dump($v);
29: }
30:
31: echo "done.\n";
32: ?>
33: --EXPECTF--
34:
35: Not an array.
36:
37: Warning: Invalid argument supplied for foreach() in %s on line 4
38:
39: Warning: Invalid argument supplied for foreach() in %s on line 9
40:
41: Warning: Invalid argument supplied for foreach() in %s on line 14
42:
43: Warning: Invalid argument supplied for foreach() in %s on line 19
44:
45: Warning: Invalid argument supplied for foreach() in %s on line 24
46: done.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>