File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug32993.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month 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: 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>