On Sat, 29 Nov 2025, Marc B. wrote:
> I have opened a simple PR to add the possibility to include called
> object in exception backtrace.
>
> https://github.com/php/php-src/pull/20599
>
> This needs a discussion here to see if there are objections.
>
> About the patch:
>
> The patch adds the ability to populate the called |object| into
> exception backtraces.
I do this in Xdebug (as part of https://bugs.xdebug.org/1562) and it's
causing some issues with fframeworks/applications that rely on
destructors being called at a specific time, or in a specific order:
https://bugs.xdebug.org/2222
The Xdebug situation is probably a little worse, as I keep that last 8
exception traces *too*, but I am sure this is going to trip up people.
>
> Previously, only |debug_backtrace()| could include the called object
> in its frames, but |Exception::getTrace()| could not. This change
> aligns |Exception::getTrace()| with |debug_backtrace()| by introducing
> a new INI directive:
>
> |zend.exception_provide_object (boolean)|
I don't think that adding an INI setting (again) is a good idea. If you
want to make this configurable, it should be an option on
Exception::getTrace() — INI settings make applications less portable
(even though this is a debugging option).
cheers,
Derick