Re: Possibility to include called object in exception backtrace
| From: | Marc B. | Date: | Tue, 02 Dec 2025 05:32:07 +0000 |
| Subject: | Re: Possibility to include called object in exception backtrace | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129499@lists.php.net to get a copy of this message | ||
Hi Derick,
On 01.12.25 12:44, Rowan Tommins [IMSoP] wrote:
On 1 December 2025 10:36:51 GMT, Derick Rethans<derick@php.net> wrote:As Rowan already mentioned, adding a parameter toI 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).A parameter on the getter would mean every exception has to capture the references just in case they're used, which would definitely be a bad idea. If I remember rightly, the existing INI setting for capturing parameters was added precisely so that users could turn *off* collection in production builds. The same reasoning applies to other debugging settings, like skipping evaluation of assertions rather than silently discarding their results.
getTrace() would require every exception object to keep a reference of the called object just to make it retrievable if requested.
Configuring it as INI option - it can, and should, be turned off on production environments.
Also, the INI option |zend.exception_provide_object would be in line ||zend.exception_ignore_args making it's use consistent with already existing behavior.|
Regards, Rowan Tommins [IMSoP]Regards, Marc