1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt

37 lines
867 B
PHP

--TEST--
SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
--FILE--
<?php
$recArrIt = new RecursiveArrayIterator([
[1, 2],
['a', 'b'],
]);
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function callHasChildren(): bool {
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 in %s
Stack trace:
#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
#1 %s: RecursiveIteratorIterator->next()
#2 {main}
thrown in %s on line %d