Re: Re: Throwable::addSuppressed()

From: Date: Sat, 01 Aug 2015 11:05:18 +0000
Subject: Re: Re: Throwable::addSuppressed()
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-87484@lists.php.net to get a copy of this message
Markus Malkusch wrote: > Markus Malkusch: > >> 2) You are loosing one stack trace > > I'd like to revise that. I'd just learned that finally does indeed fit > here, as it would automatically glue exceptions: > > try { > throw new Exception("A"); > > } finally { > throw new Exception("B"); > } > > This prints both exceptions: > > PHP Fatal error: Uncaught exception 'Exception' with message 'A' in > /home/malkusch/tmp/test.php:4 Stack trace: > > #0 {main} > > Next exception 'Exception' with message 'B' in /home/malkusch> > /tmp/test.php:7 Stack trace: > > #0 {main} > > So B's previous became A. Well I'm surprised, as there's no causality > between them, but OTOH it's called Exception::getPrevious() without any > further semantics. So this might be acceptable. Note that there's an open bug report (<https://bugs.php.net/68270>) regarding this issue. -- Christoph M. Becker

« previous php.internals (#87484) next »