Re: [PHP-DEV] exceptions during __toString()

2013-05-10 Thread Ferenc Kovacs
On Fri, May 10, 2013 at 12:50 AM, Etienne Kneuss wrote: > On Fri, May 10, 2013 at 12:00 AM, Rasmus Schultz >wrote: > > > I just ran into this issue again: > > > > > > > http://stackoverflow.com/questions/2429642/why-its-impossible-to-throw-exception-from-tostring > > > > Instead of throwing some

Re: [PHP-DEV] exceptions during __toString()

2013-05-09 Thread Rasmus Schultz
I've heard the technical explanation before, and while it probably doesn't make sense to go through all that effort to fix this... well... take this example: class Foo { public function __toString() { try { return $this->bar(); } catch (Exception $e) {

Re: [PHP-DEV] exceptions during __toString()

2013-05-09 Thread Etienne Kneuss
On Fri, May 10, 2013 at 12:00 AM, Rasmus Schultz wrote: > I just ran into this issue again: > > > http://stackoverflow.com/questions/2429642/why-its-impossible-to-throw-exception-from-tostring > > Instead of throwing some nonsense "you're not allowed to throw from here" > error-message, how about

[PHP-DEV] exceptions during __toString()

2013-05-09 Thread Rasmus Schultz
I just ran into this issue again: http://stackoverflow.com/questions/2429642/why-its-impossible-to-throw-exception-from-tostring Instead of throwing some nonsense "you're not allowed to throw from here" error-message, how about actually unwinding the stack and passing the exception to the global