8000 [ErrorHandler] Remove trigger_deprecation frame from trace by fancyweb · Pull Request #36329 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[ErrorHandler] Remove trigger_deprecation frame from trace #36329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

fancyweb
Copy link
Contributor
@fancyweb fancyweb commented Apr 3, 2020
Q A
Branch? master
Bug fix? no
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

I did not modify the cleanTrace method because it is also used for silenced errors. However, deprecations cannot be silenced. So it seems better to me to create a new method and use it when it is needed. Also we need to know the modified line and file before creating the exception. So we cannot use the exception trace, unless we create the exception twice. I don't know what is better performance wise: let me know!

@@ -468,6 +468,8 @@ public function handleError(int $type, string $message, string $file, int $line)
return true;
}
} else {
$this->handleTriggerDeprecationFunction(debug_backtrace(0), $type, $file, $line);
Copy link
Contributor Author
@fancyweb fancyweb Apr 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we reuse this backtrace instead of calling $exception->getTrace() later? I don't know when exception backtraces are "generated". So I did not touch it.

@nicolas-grekas
Copy link
Member 8000

I borrowed your test case in #36353
Thanks for submitting.

@fancyweb fancyweb deleted the error-handler-handle-trigger-deprecation branch April 6, 2020 07:48
fabpot added a commit that referenced this pull request Apr 12, 2020
…ce (fancyweb, nicolas-grekas)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[ErrorHandler] Remove trigger_deprecation frame from trace

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

This accounts for the new `trigger_deprecation` function from [symfony/deprecation-contracts](https://github.com/symfony/deprecation-contracts).

Replaces #36329

Commits
-------

d4eb4a4 [ErrorHandler] Remove trigger_deprecation frame from trace (add tests)
c293aee [ErrorHandler] Remove trigger_deprecation frame from trace
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.1 May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0