<?php
namespace HHVM\UserDocumentation\Inconsistencies\Intro\Examples\toStringExc;
class A {
public function __toString() {
throw new \Exception('Not allowed in PHP');
return 'A';
}
}
$a = new A();
try {
echo $a;
} catch (\Exception $ex) {
echo "Exception will not be thrown to here in PHP";
}
Fatal error: Method HHVM\UserDocumentation\Inconsistencies\Intro\Examples\toStringExc\A::__toString() must not throw an exception, caught Exception: Not allowed in PHP in /in/XHDP8 on line 0
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0
Fatal error: Method HHVM\UserDocumentation\Inconsistencies\Intro\Examples\toStringExc\A::__toString() must not throw an exception in /in/XHDP8 on line 0
Process exited with code 255.