Re: [PHP-DEV] Stop Exceptions capturing object references for tracearguments

This is only part of a thread. view whole thread
  100207
August 13, 2017 20:44 rowan.collins@gmail.com (Rowan Collins)
On 13/08/2017 15:31, Niklas Keller wrote:
> > If it's explicitly needed, someone could still just call > `debug_backtrace()` and manually store the args in the exception > constructor, no?
That depends exactly how it's being used, but yes if you control the throw site or Exception constructor you could grab the backtrace manually.
> > Would the args still be available in the stringified version? Because > they're quite useful for debugging there.
Hm, I guess we'd need to store the string representation (the class name, basically) somewhere so we could keep that. Doesn't seem like it ought to be too hard, unless there's some hidden complexity or performance impact there. Regards, -- Rowan Collins [IMSoP]
  100352
September 2, 2017 11:52 me@kelunik.com (Niklas Keller)
> > Would the args still be available in the stringified version? Because >> they're quite useful for debugging there. >> > > Hm, I guess we'd need to store the string representation (the class name, > basically) somewhere so we could keep that. Doesn't seem like it ought to > be too hard, unless there's some hidden complexity or performance impact > there.
Not sure whether there will be a noticeable performance impact. Formatting doesn't have to take place on collection, but a replacement of object references to some representation that can later be formatted. A refcount increase can be saved, but that's probably totally trivial performance wise. Related issue for ReactPHP's promises: https://github.com/reactphp/promise/issues/46#issuecomment-326739299 Regards, Niklas