-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Exit status is 0 on PHP7 when there is a \Throwable exception #18484
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
Comments
There's going to be a small problem with this method though: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Application.php#L606 Maybe you could extract the logic or even extract the exception handling away. |
Yeah sure, this not as easy as changing the |
Just do what the rest of symfony has done, and use symfony's exception classes to get around this. |
Check if instanceof throwable and not instanceof exception, then if that's true, create this: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Debug/Exception/FatalThrowableError.php, and pass it trough instad. |
…to Exceptions (fonsecas72) This PR was squashed before being merged into the 2.7 branch (closes #19813). Discussion ---------- [Console] fixed PHP7 Errors are now handled and converted to Exceptions | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18484 | License | MIT | Doc PR | Commits ------- d3c613b [Console] fixed PHP7 Errors are now handled and converted to Exceptions
Hi!
Pretty basic example
This in PHP7 will throw an
\Error
, which implements the\Throwable
interface. However, on https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Application.php#L118 we are only catching\Exception
to set the status code to 1. As a result, those especial exceptions in the console end up with an 0 exit status code, when it should be 1 as with all other normal exceptions. Thanks! Can work on a PR if needed :)The text was updated successfully, but these errors were encountered: