Annotation of embedaddon/php/tests/lang/foreachLoopIterator.002.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: foreach with iterator and &$value reference
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: class MyIterator implements Iterator {
        !             7:        public function valid() { return true; }
        !             8:        public function next() {        }
        !             9:        public function rewind() {      }
        !            10:        public function current() {     }
        !            11:        public function key() { }
        !            12: }
        !            13: 
        !            14: $f = new MyIterator;
        !            15: echo "-----( Try to iterate with &\$value: )-----\n";
        !            16: foreach ($f as $k=>&$v) {
        !            17:        echo "$k => $v\n";      
        !            18: }
        !            19: 
        !            20: ?>
        !            21: --EXPECTF--
        !            22: -----( Try to iterate with &$value: )-----
        !            23: 
        !            24: Fatal error: An iterator cannot be used with foreach by reference in %s on line 13

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>