ID: 50699 Updated by: [email protected] Reported By: gmblar+php at gmail dot com -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: * PHP Version: 5.3.1 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php __toString() must not throw exceptions Previous Comments: ------------------------------------------------------------------------ [2010-01-08 22:22:35] gmblar+php at gmail dot com Description: ------------ Cannot throw Exceptions in __toString(). Instead it produces a Fatal error. Reproduce code: --------------- <?php class bar { public function __toString() { throw new Exception('Incomplete Data'); } } $foo = new bar(); echo $foo; ?> Expected result: ---------------- Fatal error: Uncaught exception 'Exception' with message 'Incomplete Data' in /-:6 Actual result: -------------- Fatal error: Method bar::__toString() must not throw an exception in /- on line 0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50699&edit=1
