Annotation of embedaddon/php/Zend/tests/bug32993.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #32993 (implemented Iterator function current() don't throw exception)
        !             3: --FILE--
        !             4: <?php
        !             5: class Test implements Iterator {
        !             6: 
        !             7:     public $arr = array();
        !             8: 
        !             9:     public function rewind()    { return reset($this->arr); }
        !            10:     public function current()   { throw new Exception(); }
        !            11:     public function key()       { return key($this->arr); }
        !            12:     public function next()      { return next($this->arr); }
        !            13:     public function valid()     { return (current($this->arr) !== false); }
        !            14: }
        !            15: 
        !            16: $t = new Test();
        !            17: $t->arr =  array(1, 2, 3);
        !            18: 
        !            19: try {
        !            20:     foreach ($t as $v) {
        !            21:         echo "$v\n";
        !            22:     }
        !            23: } catch (Exception $e) {
        !            24:     ; // handle exception
        !            25: }
        !            26: echo "ok\n";
        !            27: ?>
        !            28: --EXPECT--
        !            29: ok

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