Helpers::handleErrors()
: Exception robustness
#6105
Merged
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.
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 actionBreaking changes
None
Ready?
For review team
Add to website docs release checklist (if needed)