<?php
class A {
function get()
{
throw new Exception();
}
}
class B {
function __toString()
{
$a = new A;
return $a->get();
}
}
$b = new B;
var_dump((string) $b);
Fatal error: Uncaught Exception in /in/vtvLW:6
Stack trace:
#0 /in/vtvLW(16): A->get()
#1 /in/vtvLW(21): B->__toString()
#2 {main}
thrown in /in/vtvLW on line 6
Process exited with code 255.