1--TEST-- 2SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next() 3--FILE-- 4<?php 5 6$arr = array(array(1,2),2); 7$arrOb = new ArrayObject($arr); 8 9$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); 10 11class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { 12 13 function beginchildren(): void { 14 throw new Exception; 15 } 16} 17 18 19$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); 20 21var_dump($recItIt->next()); 22 23$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY); 24 25var_dump($recItIt2->next()); 26 27?> 28--EXPECTF-- 29NULL 30 31Fatal error: Uncaught Exception in %s 32Stack trace: 33#0 [internal function]: MyRecursiveIteratorIterator->beginchildren() 34#1 %s: RecursiveIteratorIterator->next() 35#2 {main} 36 thrown in %s on line %d 37