1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Files
archived-php-src/ext/spl/tests/RecursiveIteratorIterator_invalid_aggregate.phpt
Nikita Popov b9ae73eee9 Fix RecursiveIteratorIterator segfault for invalid aggregate
The code was assuming that the returned value is an object.
Reuse the logic from IteratorIterator.
2021-07-15 13:11:28 +02:00

21 lines
470 B
PHP

--TEST--
RecursiveIteratorIterator constructor should thrown if IteratorAggregate does not return Iterator
--FILE--
<?php
class MyIteratorAggregate implements IteratorAggregate {
function getIterator() {
return null;
}
}
try {
new RecursiveIteratorIterator(new MyIteratorAggregate);
} catch (LogicException $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
MyIteratorAggregate::getIterator() must return an object that implements Traversable