Annotation of embedaddon/php/ext/spl/tests/spl_iterator_apply_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: Error: iterator_apply when an iterator method (eg rewind) throws exception
3: --FILE--
4: <?php
5:
6: class MyArrayIterator extends ArrayIterator {
7: public function rewind() {
8: throw new Exception('Make the iterator break');
9: }
10: }
11:
12: function test() {}
13:
14: $it = new MyArrayIterator(array(1, 21, 22));
15:
16: try {
17: $res = iterator_apply($it, 'test');
18: } catch (Exception $e) {
19: echo $e->getMessage();
20: }
21:
22: ?>
23:
24: <?php exit(0); ?>
25: --EXPECT--
26: Make the iterator break
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>