mirror of
https://github.com/php/php-src.git
synced 2024-10-19 15:34:25 +00:00
34 lines
657 B
Plaintext
34 lines
657 B
Plaintext
|
--TEST--
|
||
|
SPL: RecursiveTreeIterator and Exception from getEntry()
|
||
|
--INI--
|
||
|
error_reporting=E_ALL&~E_NOTICE
|
||
|
--FILE--
|
||
|
<?php
|
||
|
|
||
|
$ary = array(new stdClass);
|
||
|
|
||
|
class RecursiveArrayIteratorAggregated implements IteratorAggregate {
|
||
|
public $it;
|
||
|
function __construct($it) {
|
||
|
$this->it = new RecursiveArrayIterator($it);
|
||
|
}
|
||
|
function getIterator() {
|
||
|
return $this->it;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$it = new RecursiveArrayIteratorAggregated($ary);
|
||
|
try {
|
||
|
foreach(new RecursiveTreeIterator($it) as $k => $v) {
|
||
|
echo "[$k] => $v\n";
|
||
|
}
|
||
|
} catch (UnexpectedValueException $e) {
|
||
|
echo "UnexpectedValueException thrown\n";
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
===DONE===
|
||
|
--EXPECTF--
|
||
|
UnexpectedValueException thrown
|
||
|
===DONE===
|