Annotation of embedaddon/php/tests/lang/foreachLoop.011.phpt, revision 1.1

1.1     ! misho       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>