File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
tests /
lang /
foreachLoop.011.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
1: --TEST--
2: Changing from an interable type to a non iterable type during the iteration
3: --FILE--
4: <?php
5: echo "\nChange from array to non iterable:\n";
6: $a = array(1,2,3);
7: $b=&$a;
8: foreach ($a as $v) {
9: var_dump($v);
10: $b=1;
11: }
12:
13: echo "\nChange from object to non iterable:\n";
14: $a = new stdClass;
15: $a->a=1;
16: $a->b=2;
17: $b=&$a;
18: foreach ($a as $v) {
19: var_dump($v);
20: $b='x';
21: }
22:
23: ?>
24: --EXPECTF--
25:
26: Change from array to non iterable:
27: int(1)
28:
29: Warning: Invalid argument supplied for foreach() in %s on line 5
30:
31: Change from object to non iterable:
32: int(1)
33:
34: Warning: Invalid argument supplied for foreach() in %s on line 15
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>