Annotation of embedaddon/php/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
3: --FILE--
4: <?php
5:
6: $arr = array(1,2);
7: $arrOb = new ArrayObject($arr);
8:
9: $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
10:
11: class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
12:
13: function callHasChildren() {
14: throw new Exception;
15: }
16: }
17:
18:
19: $recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
20:
21: var_dump($recItIt->next());
22:
23: $recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
24:
25: var_dump($recItIt2->next());
26:
27: ?>
28: --EXPECTF--
29: NULL
30:
31: Fatal error: Uncaught exception 'Exception' in %s
32: Stack trace:
33: #0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
34: #1 %s: RecursiveIteratorIterator->next()
35: #2 {main}
36: thrown in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>