1--TEST--
2SPL: Error: iterator_apply when an iterator method (eg rewind) throws exception
3--FILE--
4<?php
5
6class MyArrayIterator extends ArrayIterator {
7    public function rewind() {
8        throw new Exception('Make the iterator break');
9    }
10}
11
12function test() {}
13
14$it = new MyArrayIterator(array(1, 21, 22));
15
16try {
17    $res = iterator_apply($it, 'test');
18} catch (Exception $e) {
19    echo $e->getMessage();
20}
21
22?>
23
24<?php exit(0); ?>
25--EXPECT--
26Make the iterator break
27