Adds possibility to include called object in exception backtrace #20599
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds the ability to populate the called
objectinto exception backtraces.Previously, only
debug_backtrace()could include the called object in its frames, butException::getTrace()could not. This change alignsException::getTrace()withdebug_backtrace()by introducing a new INI directive:zend.exception_provide_object (boolean)This directive is analogous to the existing
zend.exception_ignore_argsoption, but controls whether theobjectfield is included in exception backtraces.Behavior:
object(where applicable).Defaults:
zend.exception_provide_object = Offphp.ini-production:zend.exception_provide_object = Offphp.ini-development:zend.exception_provide_object = OnUse cases and considerations:
This feature is primarily intended for development and debugging.
Provides richer diagnostic information by exposing the actual object on which methods were invoked.
Can help track down state-dependent bugs that depend on specific object properties.
However, it is not recommended for production environments, because:
For production systems,
zend.exception_provide_objectshould remain disabled.Open questions:
zend.exception_provide_objectbe enabled by default inrun-tests.php(similar tozend.exception_ignore_args=0)