xref: /PHP-7.1/ext/spl/tests/bug42703.phpt (revision 7af945e2)
1--TEST--
2Bug #42703 (Exception raised in an iterator::current() causes segfault in FilterIterator)
3--FILE--
4<?php
5class 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
26try {
27  foreach($itit as $key => $value) {
28  	echo $key, $value;
29  }
30}
31catch (Exception $e) {
32	var_dump($e->getMessage());
33}
34
35var_dump($itit->current());
36var_dump($itit->key());
37?>
38--EXPECTF--
39string(3) "boo"
40NULL
41NULL
42