<?php
class FooIterator extends ArrayIterator{
function __construct(){ throw new Exception; }
}
class Foo implements IteratorAggregate{
function getIterator(){
return new FooIterator();
}
}
function baz(){
$x = new Foo;
foreach($x as $y => $z);
}
function bar(){
baz();
}
function rofl(){
bar();
}
function lol(){
rofl();
}
lol();
Deprecated: Return type of Foo::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/uJ6gS on line 8
Fatal error: Uncaught Exception in /in/uJ6gS:4
Stack trace:
#0 /in/uJ6gS(9): FooIterator->__construct()
#1 /in/uJ6gS(15): Foo->getIterator()
#2 /in/uJ6gS(19): baz()
#3 /in/uJ6gS(23): bar()
#4 /in/uJ6gS(27): rofl()
#5 /in/uJ6gS(30): lol()
#6 {main}
thrown in /in/uJ6gS on line 4
Process exited with code 255.