Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cleanup the new ErrorHandler component #32605

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

Closed
5 tasks done
nicolas-grekas opened this issue Jul 18, 2019 · 10 comments
Closed
5 tasks done

Cleanup the new ErrorHandler component #32605

nicolas-grekas opened this issue Jul 18, 2019 · 10 comments

Comments

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jul 18, 2019

Right now, this component is a copy/paste from Debug, but it can and should diverge now.

Here are things that should be done, to be confirmed by trying:

/cc @fancyweb @yceruto as you like this part of the code base :)

@yceruto
Copy link
Member

yceruto commented Jul 18, 2019

Yes, I'll take a look soon 👍

fabpot added a commit that referenced this issue Jul 25, 2019
…yceruto)

This PR was squashed before being merged into the 4.4 branch (closes #32637).

Discussion
----------

[ErrorHandler] Decouple from ErrorRenderer component

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | part of #32605
| License       | MIT
| Doc PR        | -

built on top of #32636 (See 2nd commit only)

Commits
-------

8f13fc0 [ErrorHandler] Decouple from ErrorRenderer component
@yceruto yceruto added this to the next milestone Jul 30, 2019
@fancyweb
Copy link
Contributor

remove the FatalErrorException class and namespace: this doesn't apply anymore since PHP7, right?

@yceruto Looking at this.

@nicolas-grekas I have several questions.

Al of our own fatal error handlers are indeed useless since PHP 7. However, the ErrorHandler::getFatalErrorHandlers is an extension point that allow userland to define their own handlers. Removing it is removing a feature. So should we just remove our own useless handlers and keep the behavior or remove our handlers + deprecate the method to remove it later with all the associated behavior or just remove everything since it's a new component?

Also, should we clean the Debug component as well or we just let it die with unneeded classes?

@Tobion
Copy link
Contributor

Tobion commented Aug 1, 2019

Debug component is deprecated. No point in changing that.

@vudaltsov
Copy link
Contributor

It seems that E_STRICT can be dropped, because it's not used anymore in PHP 7. See https://wiki.php.net/rfc/reclassify_e_strict

@fancyweb
Copy link
Contributor

fancyweb commented Aug 5, 2019

For information, I'm working on handling \Throwable directly in ErrorHandler::handleException() too.

@vudaltsov Are you able to take care of the E_STRICT removal?

@vudaltsov
Copy link
Contributor

@fancyweb , yes, I am. Will look at it tomorrow.

@derrabus
Copy link
Member

derrabus commented Aug 8, 2019

I like where this is going. May I reopen #26514?

@fancyweb
Copy link
Contributor

fancyweb commented Sep 6, 2019

About the E_STRICT removal: I think we need to keep it. The constant was not removed from PHP so users can still trigger with this level.

@vudaltsov
Copy link
Contributor

@fancyweb , that's a nice point, fully agree. But then we can add a deprecation there, so that devs stop triggering E_STRICT.

Earlier I promised to help with this. But I got a new job and don't have much time at the moment.

fabpot added a commit that referenced this issue Sep 27, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Forward \Throwable

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32605
| License       | MIT
| Doc PR        | -

The goal of this PR is that `ErrorHandler::handleException()` handles `\Throwable` directly and forwards it  without altering it.

Commits
-------

62483ed [ErrorHandler] Forward \Throwable
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this issue Sep 27, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Forward \Throwable

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#32605
| License       | MIT
| Doc PR        | -

The goal of this PR is that `ErrorHandler::handleException()` handles `\Throwable` directly and forwards it  without altering it.

Commits
-------

62483ed305 [ErrorHandler] Forward \Throwable
symfony-splitter pushed a commit to symfony/console that referenced this issue Sep 27, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Forward \Throwable

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#32605
| License       | MIT
| Doc PR        | -

The goal of this PR is that `ErrorHandler::handleException()` handles `\Throwable` directly and forwards it  without altering it.

Commits
-------

62483ed305 [ErrorHandler] Forward \Throwable
symfony-splitter pushed a commit to symfony/error-handler that referenced this issue Sep 27, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Forward \Throwable

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#32605
| License       | MIT
| Doc PR        | -

The goal of this PR is that `ErrorHandler::handleException()` handles `\Throwable` directly and forwards it  without altering it.

Commits
-------

62483ed305 [ErrorHandler] Forward \Throwable
symfony-splitter pushed a commit to symfony/http-kernel that referenced this issue Sep 27, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Forward \Throwable

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#32605
| License       | MIT
| Doc PR        | -

The goal of this PR is that `ErrorHandler::handleException()` handles `\Throwable` directly and forwards it  without altering it.

Commits
-------

62483ed [ErrorHandler] Forward \Throwable
Tobion added a commit that referenced this issue Oct 11, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Rework fatal errors

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32605
| License       | MIT
| Doc PR        | -

Built on top of #33038 so review only the second commit : d5c3f7e

The goals of this PR is to replace current "fatal error handlers" with "error enhancers" since all our current fatal error handlers works on \Error since PHP7.

That means we won't use the FatalErrorException anymore, so we will be able to remove it (once we don't need it in the rest of the codebase).

The final goal btw is to handle \Throwable everywhere in the code so we can remove FatalThrowableError & FatalErrorException classes.

Commits
-------

aaa0cdf [ErrorHandler] Rework fatal error handlers
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this issue Oct 11, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Rework fatal errors

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#32605
| License       | MIT
| Doc PR        | -

Built on top of symfony/symfony#33038 so review only the second commit : symfony/symfony@d5c3f7e

The goals of this PR is to replace current "fatal error handlers" with "error enhancers" since all our current fatal error handlers works on \Error since PHP7.

That means we won't use the FatalErrorException anymore, so we will be able to remove it (once we don't need it in the rest of the codebase).

The final goal btw is to handle \Throwable everywhere in the code so we can remove FatalThrowableError & FatalErrorException classes.

Commits
-------

aaa0cdf523 [ErrorHandler] Rework fatal error handlers
symfony-splitter pushed a commit to symfony/http-kernel that referenced this issue Oct 11, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Rework fatal errors

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#32605
| License       | MIT
| Doc PR        | -

Built on top of symfony/symfony#33038 so review only the second commit : symfony/symfony@d5c3f7e

The goals of this PR is to replace current "fatal error handlers" with "error enhancers" since all our current fatal error handlers works on \Error since PHP7.

That means we won't use the FatalErrorException anymore, so we will be able to remove it (once we don't need it in the rest of the codebase).

The final goal btw is to handle \Throwable everywhere in the code so we can remove FatalThrowableError & FatalErrorException classes.

Commits
-------

aaa0cdf [ErrorHandler] Rework fatal error handlers
symfony-splitter pushed a commit to symfony/console that referenced this issue Oct 11, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Rework fatal errors

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#32605
| License       | MIT
| Doc PR        | -

Built on top of symfony/symfony#33038 so review only the second commit : symfony/symfony@d5c3f7e

The goals of this PR is to replace current "fatal error handlers" with "error enhancers" since all our current fatal error handlers works on \Error since PHP7.

That means we won't use the FatalErrorException anymore, so we will be able to remove it (once we don't need it in the rest of the codebase).

The final goal btw is to handle \Throwable everywhere in the code so we can remove FatalThrowableError & FatalErrorException classes.

Commits
-------

aaa0cdf523 [ErrorHandler] Rework fatal error handlers
@yceruto
Copy link
Member

yceruto commented Oct 15, 2019

All tasks completed so far, thank you to everyone involved!

@yceruto yceruto closed this as completed Oct 15, 2019
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
nicolas-grekas added a commit that referenced this issue Nov 5, 2019
… down (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

Deprecate things that prevent \Throwable from bubbling down

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes (todo update CHANGELOGS & UPGRADES)
| Tests pass?   | yes
| Fixed tickets | #32605
| License       | MIT
| Doc PR        | -

~The goal of this PR is to allow `\Throwable` forwarded from the`ErrorHandler::handleException()` method (cf #33038) to bubble down in our code base without having to convert them into exceptions.~

~WIP because I'm blocked by 2 things caused by `GetResponseForExceptionEvent::getThrowable()` returning a `\Throwable` instead of an `\Exception`.~

~1. This `\Throwable` end up in `DataCollectorInterface::collect()` (cf `ProfilerListener`). So that looks impossible to support in 4.4. What can we do?~
~2. The second blocker is `ExceptionListener::duplicateRequest()`. We are not gonna rename this method to support `\Throwable` I guess. What can we do?~

Since there are blockers to do it in 4.4, let's prepare for the future and deprecate the things that block us.

Commits
-------

abef506 Deprecate things that prevent \Throwable from bubbling down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants