Skip to content
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

Helpers::handleErrors(): Exception robustness #6105

Merged
merged 1 commit into from
Dec 31, 2023

Conversation

lukasbestle
Copy link
Member

@lukasbestle lukasbestle commented Dec 31, 2023

Interestingly, this change didn't allow to remove the superfluous error handler restore in the testHandleErrorsWarningCaughtCallbackValue. So something super weird seems to be going on in PHPUnit 9.

However the test I've newly added only works with the try {} finally {} change. Without the change, the new test would introduce the same "missing restore" behavior. So the change is at least useful for exceptions that are thrown by or in the action, which should be the most common case in practice. Now I understand why PHPUnit 10 removed the conversion from errors/warnings to exceptions: It's a pain in the butt. ;)


This PR …

Fixes

  • Helpers::handleErrors() correctly restores the original error handler even if an exception is thrown in the action

Breaking changes

None

Ready?

  • Unit tests for fixed bug/feature
  • In-code documentation (wherever needed)
  • Tests and checks all pass

For review team

@lukasbestle lukasbestle added this to the 4.1.0 milestone Dec 31, 2023
@lukasbestle lukasbestle self-assigned this Dec 31, 2023
@distantnative distantnative merged commit 622152e into develop-minor Dec 31, 2023
12 checks passed
@distantnative distantnative deleted the fix/handle-errors-exception branch December 31, 2023 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants