summaryrefslogtreecommitdiff
path: root/ext/spl/tests/spl_iterator_apply_error.phpt
blob: 8e7cba483a590e2772aa1160d8841035febc307e (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
--TEST--
SPL: Error: iterator_apply when an iterator method (eg rewind) throws exception
--FILE--
<?php

class MyArrayIterator extends ArrayIterator {
	public function rewind() {
		throw new Exception('Make the iterator break');
	}
}

function test() {}

$it = new MyArrayIterator(array(1, 21, 22));

try {
	$res = iterator_apply($it, 'test');
} catch (Exception $e) {
	echo $e->getMessage();
}

?>

<?php exit(0); ?>
--EXPECT--
Make the iterator break