mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_arrayobject_and_arrayiterator_with_objects This also moves tests into a subfolder.
37 lines
853 B
PHP
37 lines
853 B
PHP
--TEST--
|
|
SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()
|
|
--FILE--
|
|
<?php
|
|
|
|
$recArrIt = new RecursiveArrayIterator([
|
|
[1, 2],
|
|
['a', 'b'],
|
|
]);
|
|
|
|
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
|
|
|
function nextelement(): void {
|
|
throw new Exception;
|
|
}
|
|
}
|
|
|
|
|
|
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
|
|
|
var_dump($recItIt->next());
|
|
|
|
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
|
|
|
var_dump($recItIt->next());
|
|
|
|
?>
|
|
--EXPECTF--
|
|
NULL
|
|
|
|
Fatal error: Uncaught Exception in %s
|
|
Stack trace:
|
|
#0 [internal function]: MyRecursiveIteratorIterator->nextelement()
|
|
#1 %s: RecursiveIteratorIterator->next()
|
|
#2 {main}
|
|
thrown in %s on line %d
|