Annotation of embedaddon/php/ext/spl/tests/bug42703.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #42703 (Exception raised in an iterator::current() causes segfault in FilterIterator)
                      3: --FILE--
                      4: <?php
                      5: class BlaIterator implements Iterator
                      6: {
                      7:        public function rewind() { }
                      8:        
                      9:        public function next() { }
                     10:        
                     11:        public function valid() {
                     12:                return true;
                     13:        }
                     14:        
                     15:        public function current()
                     16:        {
                     17:          throw new Exception('boo');
                     18:        }
                     19:        
                     20:        public function key() { }
                     21: }
                     22: 
                     23: $it = new BlaIterator();
                     24: $itit = new IteratorIterator($it);
                     25: 
                     26: try {
                     27:   foreach($itit as $key => $value) {
                     28:        echo $key, $value;
                     29:   }
                     30: }
                     31: catch (Exception $e) {
                     32:        var_dump($e->getMessage());
                     33: }
                     34: 
                     35: var_dump($itit->current());
                     36: var_dump($itit->key());
                     37: ?>
                     38: --EXPECTF--
                     39: string(3) "boo"
                     40: NULL
                     41: NULL

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