10000 [Console] Apps can no longer expect their fatal error handlers to be triggered · Issue #22678 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Apps can no longer expect their fatal error handlers to be triggered #22678

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
ciaranmcnulty opened this issue May 9, 2017 · 2 comments
Labels

Comments

@ciaranmcnulty
Copy link
Contributor
ciaranmcnulty commented May 9, 2017
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 3.2.8

There is a behaviour change in this version; previously a Throwable that occurred during a console command's run would be thrown upwards. It's now caught and turned into an Exception.

The change in question is here:
https://github.com/symfony/symfony/pull/22435/files#r115471431

For an example of how this causes an issue, in PhpSpec we maintain a 2.5 bugfix branch that does not know how to handle Throwables, instead relying on a mechanism that uses register_shutdown_function to format a nice error message when a fatal error occurs. As of Symfony 3.2.8 this message is no longer shown, because the shutdown function never executes.

This is something we could of course code around, but it's not a change I'd expect to be introduced in a patch.

@chalasr
Copy link
Member
chalasr commented May 11, 2017

I confirm the bug, up to master. console.exception|error listeners should be able to handle throwables, but if they don't, the error should reach the error handler (original error should be rethrown), which is not the case anymore (neither the Debug one nor custom error handlers are reached).

@chalasr
Copy link
Member
chalasr commented May 11, 2017

@ciaranmcnulty Could you try #22690?

fabpot added a commit that referenced this issue May 11, 2017
…onsole.error listeners (chalasr)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix errors not rethrown even if not handled by console.error listeners

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

#22261 has been squashed while revisiting error handling, this fixes it again while keeping latest changes intact.

__code__
```php
public function execute(InputInterface $input, OutputInterface $output) {
    $this->barr();
}

public function bar() { }
```

__before__
![before](http://image.prntscr.com/image/38aa3b46fed6439ead693908ab104fb3.png)

__after__
![after](http://image.prntscr.com/image/071322bfa52247c6a02eac6ef9d8284a.png)

Commits
-------

75f098f Fix errors not rethrown even if not handled by console.error listeners
@fabpot fabpot closed this as completed May 11, 2017
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