[Console] fixed PHP7 Errors are now handled in Application::run and a… #20917
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.
PRs #19813 and #20736 do not complete solve every problem with PHP7 new \Error class. This PR adds additional catching in Application::run, and as such the Application now returns status code 1 when \Error occurs, and closes #20775.
More info:
If there is no dispatcher, due to #20736 everything will work fine, FatalThrowableError will be rethrown, and that is catched by the try/catch in Application::run.
When there is a dispatcher, but there is no console.exception Listener that modifies the exception, code in PR #19813 will rethrow the original exception (\Error), and not the wrapped one. Since Application:run only catches Exceptions \Error will not get caught by try/catch in Application::run, and as a result status code will be 0, which is obviously wrong.