summaryrefslogtreecommitdiff
path: root/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt')
-rw-r--r--ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt36
1 files changed, 36 insertions, 0 deletions
diff --git a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt
new file mode 100644
index 0000000..88f03fb
--- /dev/null
+++ b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt
@@ -0,0 +1,36 @@
+--TEST--
+SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
+--FILE--
+<?php
+
+$arr = array(1,2);
+$arrOb = new ArrayObject($arr);
+
+$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function callHasChildren() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+var_dump($recItIt->next());
+
+$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+var_dump($recItIt2->next());
+
+?>
+--EXPECTF--
+NULL
+
+Fatal error: Uncaught exception 'Exception' in %s
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in %s on line %d