summaryrefslogtreecommitdiff
path: root/ext/spl/tests/bug42703.phpt
blob: 5c52763cd694dc696f33fdd5577a41b529b69b46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--TEST--
Bug #42703 (Exception raised in an iterator::current() causes segfault in FilterIterator)
--FILE--
<?php
class BlaIterator implements Iterator
{
	public function rewind() { }
	
	public function next() { }
	
	public function valid() {
		return true;
	}
	
	public function current()
	{
	  throw new Exception('boo');
	}
	
	public function key() { }
}

$it = new BlaIterator();
$itit = new IteratorIterator($it);

try {
  foreach($itit as $key => $value) {
  	echo $key, $value;
  }
}
catch (Exception $e) {
	var_dump($e->getMessage());
}

var_dump($itit->current());
var_dump($itit->key());
?>
--EXPECTF--
string(3) "boo"
NULL
NULL