8000 Application exit code not properly handled, when having fatal exceptions, Symfony 2.8, PHP7 · Issue #20110 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Application exit code not properly handled, when having fatal exceptions, Symfony 2.8, PHP7 #20110

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
bozerkins opened this issue Sep 30, 2016 · 3 comments
Labels

Comments

@bozerkins
Copy link
bozerkins commented Sep 30, 2016

when a command throws a fatal error in PHP7, the exception produced is handled by global error handler, not application error handler.

thus the error message is properly handled, but the exit code is not.

such code for example (for tests or more) could lead to such behavior, under Symfony 2.8 / PHP 7
$a = null; $a->getSmth();
under PHP 5.3 the above command execution would exit with non zero exit code.
under PHP7.* this would end up with exit code being zero, which is not good.

the problem is in the - Symfony/Component/Console/Application.php:124,
where only \Exception class is catched
#20111

@sh4ka
Copy link
sh4ka commented Oct 3, 2016

Can this be related to #19078 ??
OP: Can you verify is the same problem? Thanks a lot.

@bozerkins
Copy link
Author

No. The problem is different.
#20110 - is about catching console application fatal exceptions in PHP7 (which are generated by PHP, not triggered by user)
#19078 - is about catching user exceptions, triggered in "kernel terminate" event dispatcher

@sh4ka
Copy link
sh4ka commented Oct 3, 2016

Brilliant. Just ringed a bell for me and I wanted to make sure.

@xabbuh xabbuh added the Console label Oct 7, 2016
fabpot added a commit that referenced this issue Dec 5, 2016
…adus)

This PR was squashed before being merged into the 2.7 branch (closes #20736).

Discussion
----------

[Console] fixed PHP7 Errors when not using Dispatcher

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #17257, #20110, #20111
| License       | MIT
| Doc PR        | n/a

Original fix, #19813, works only when there is event dispatcher available.
This PR fix the issue also for scenario without event dispatcher.

Closes #20110 issue and #20111 PR connected to it.
Closing #17257 , as everywhere the error is converted to exception and it should be handled

Commits
-------

899fa79 [Console] fixed PHP7 Errors when not using Dispatcher
@fabpot fabpot closed this as completed Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
0