Skip to content

Catch \Throwable #18813

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

Merged
merged 1 commit into from
May 23, 2016
Merged

Catch \Throwable #18813

merged 1 commit into from
May 23, 2016

Conversation

fprochazka
Copy link
Contributor

@fprochazka fprochazka commented May 19, 2016

Q A
Branch? 2.7, 2.8, 3.0
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? Yes
Fixed tickets n/a
License MIT
Doc PR n/a

Related #18765, #15949
Depends on #18812

@nicolas-grekas
Copy link
Member

👍

@xabbuh
Copy link
Member

xabbuh commented May 23, 2016

👍

@fabpot
Copy link
Member

fabpot commented May 23, 2016

Thank you @fprochazka.

@fabpot fabpot merged commit 103526b into symfony:2.7 May 23, 2016
fabpot added a commit that referenced this pull request May 23, 2016
This PR was merged into the 2.7 branch.

Discussion
----------

Catch \Throwable

| Q             | A
| ------------- | ---
| Branch?       | 2.7, 2.8, 3.0
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | Yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Related #18765, #15949
Depends on #18812

Commits
-------

103526b Catch \Throwable
fabpot added a commit that referenced this pull request May 23, 2016
This PR was merged into the 2.8 branch.

Discussion
----------

Catch \Throwable

| Q             | A
| ------------- | ---
| Branch?       | 2.8, 3.0
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | Mostly!
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

The first commit is based on #15949
Depends on #18813, #18812

----

I'm new to symfony, so I'm not sure where are all the places where it makes sense to actually catch the throwable and where not. I added most places that seemed logical and when I wasn't sure, I added it anyway. I'm hoping you guys (and girls?) can point out the places where the catch should not be added, I'll fix it and then I can create several PR's for the older branches. A lot of this IMHO should go also to 3.0.

Commits
-------

de671f4 Catch \Throwable
symfony-splitter pushed a commit to symfony/dependency-injection that referenced this pull request May 23, 2016
This PR was merged into the 2.8 branch.

Discussion
----------

Catch \Throwable

| Q             | A
| ------------- | ---
| Branch?       | 2.8, 3.0
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | Mostly!
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

The first commit is based on symfony/symfony#15949
Depends on symfony/symfony#18813, symfony/symfony#18812

----

I'm new to symfony, so I'm not sure where are all the places where it makes sense to actually catch the throwable and where not. I added most places that seemed logical and when I wasn't sure, I added it anyway. I'm hoping you guys (and girls?) can point out the places where the catch should not be added, I'll fix it and then I can create several PR's for the older branches. A lot of this IMHO should go also to 3.0.

Commits
-------

de671f4 Catch \Throwable
@fprochazka fprochazka deleted the 2.7-php7-throwable branch May 23, 2016 13:32
@fabpot fabpot mentioned this pull request May 26, 2016
@patrick-mcdougle
Copy link
Contributor

patrick-mcdougle commented May 31, 2016

According to the PHP documentation:

PHP classes cannot implement the Throwable interface directly, and must instead extend Exception.

Are we sure this change is needed? Additionally, what does this do when php < 7?

@fprochazka
Copy link
Contributor Author

fprochazka commented Jun 5, 2016

Are we sure this change is needed?

Yes it is. Theese cases would normally be handled using finally, but since this branch supports PHP 5.3, it has to be done like this.

Additionally, what does this do when php < 7?

it is ignored

@patrick-mcdougle
Copy link
Contributor

I guess what I mean is that everything would be caught by the above catch(\Exception) block since all \Throwable MUST extend \Excpetion.

@xabbuh
Copy link
Member

xabbuh commented Jun 5, 2016

@patrick-mcdougle The Error class (introduced in PHP 7) implements Throwable but does not extend the Exception class.

@patrick-mcdougle
Copy link
Contributor

Thanks for the explanation @xabbuh !

This was referenced Jun 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants