Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Catch \Throwable#18765

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:2.8fromfprochazka:php7-throwable
May 23, 2016
Merged

Catch \Throwable#18765

fabpot merged 1 commit intosymfony:2.8fromfprochazka:php7-throwable
May 23, 2016

Conversation

@fprochazka
Copy link
Contributor

@fprochazkafprochazka commentedMay 12, 2016
edited
Loading

QA
Branch?2.8, 3.0
Bug fix?no
New feature?no
BC breaks?no
Deprecations?no
Tests pass?Mostly!
Fixed ticketsn/a
LicenseMIT
Doc PRn/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.

@stof
Copy link
Member

some of these changes should actually be done in 2.3 or in 2.7 too. Can you open 3 PRs instead ?

  • one for 2.3 changing all affected places relevant for 2.3
  • another one for 2.7 changing the places relevant in 2.7+ (not changing the places already changed in the previous PR)
  • another one for 2.8 for 2.8+ changes (you can update the current PR for that by removing parts of the patch as it already targets the 2.8 branch)

@fprochazka
Copy link
ContributorAuthor

I wasn't aware the 2.3 is still maintained :) I'll do that then.

@fprochazka
Copy link
ContributorAuthor

@stof I think it would be more productive to have 90% of the discussion under one PR and I can split it after this is cleaned, so I'm not doing it over 4 branches.

@fprochazkafprochazkaforce-pushed thephp7-throwable branch 5 times, most recently fromeeae733 to0fd9ef3CompareMay 12, 2016 17:01

namespace Symfony\Component\Console\Exception;

class FatalThrowableError extends \ErrorException
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This, and the other one inSecurity/Http are copied fromSymfony\Component\Debug\Exception\FatalErrorException, since there is no direct dependency.

}catch (\Exception$e) {
// unable to optimize unknown notation
}catch (\Throwable$e) {
// unable to optimize unknown notation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

-1 for this one. Getting an Error in the parser should not happen when it is an unknown notation (the parser is expected to throw an Exception in such case), so it would only hide bugs

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Makes sense, having it more specific and only throw away something, not everything seems more sane 👍

@fprochazkafprochazka changed the titleCatch \Throwable where finally cannot be usedCatch \ThrowableMay 12, 2016
$e->getCode(),
$severity,
$e->getFile(),
$e->getLine()
Copy link
ContributorAuthor

@fprochazkafprochazkaMay 13, 2016
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Btw, why is theThrowable not added as previous inSymfony\Component\Debug\Exception\FatalThrowableError ? It doesn't feel right to throw it away completely.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The original is not thrown away: the state of the new FatalThrowableError has all bits from the original Error exception. Adding it as previous would defeat the purpose of FatalThrowableError, which is to pass the \Exception type hints (even for exceptions in the previous chain).

@nicolas-grekas
Copy link
Member

I'm mostly 👎 but on a few spots: \Error should not be dealt with as regular exceptions. They are a sign of serious issues and recovering after them is encouraging not fixing the related issues to me.
Should be thought on a case by case basis.

@stof
Copy link
Member

yeah, catching them is fine in places where they are rethrown after some cleanup (use case forfinally in newer versions of PHP), but other places should probably let them bubble most of the time

}catch (\Exception$e) {
$exitCode =1;
$rows[] =array(sprintf('<fg=red;options=bold>%s</>','\\' ===DIRECTORY_SEPARATOR ?'ERROR' :"\xE2\x9C\x98"/* HEAVY BALLOT X (U+2718) */),$message,$e->getMessage());
}catch (\Throwable$e) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

should be removed

// the response that comes back is simply ignored
if (isset($options['ignore_errors']) &&$options['ignore_errors'] &&$this->dispatcher) {
$event =newGetResponseForExceptionEvent($this->kernel,$request, HttpKernelInterface::SUB_REQUEST,$e);
}catch (\Throwable$e) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

should be reverted OR discussed in a dedicated PR

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedMay 15, 2016
edited
Loading

@fprochazka thanks for this PR. I added a comment everywhere I think catchingThrowable should be reverted. All the other non-commented places look fine to me.


// Using user_error() here is on purpose so we do not forget
// that this alias also should work alongside with trigger_error().
returnuser_error($e,E_USER_ERROR);
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

So... should I still create a testcase for this with new fixture for throwable?

@fprochazka
Copy link
ContributorAuthor

@nicolas-grekas I've removed those where I agree, but I would like a better reasoning behind those I left untouched, that you've commented. They seem important to me.

@fprochazkafprochazkaforce-pushed thephp7-throwable branch 5 times, most recently from1b61b94 to76f5f90CompareMay 19, 2016 12:08
@fprochazka
Copy link
ContributorAuthor

fprochazka commentedMay 19, 2016
edited
Loading

All the comments are solved, so I'm gonna start spliting this to more branchesas @stof said

This was referencedMay 19, 2016
@fprochazkafprochazkaforce-pushed thephp7-throwable branch 2 times, most recently from38b4d5c tode671f4CompareMay 19, 2016 14:07
@fprochazka
Copy link
ContributorAuthor

Should I try to help with PR for 3.0? Or will the mergers solve the possible conflicts and throw away changes that are not relevant in 3.0? As I'm sure there will be some.

@nicolas-grekas
Copy link
Member

👍

@xabbuh
Copy link
Member

👍

fabpot added a commit that referenced this pull requestMay 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/aRelated#18765,#15949Depends on#18812Commits-------103526b Catch \Throwable
@fabpot
Copy link
Member

Thank you@fprochazka.

@fabpotfabpot merged commitde671f4 intosymfony:2.8May 23, 2016
fabpot added a commit that referenced this pull requestMay 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/aThe first commit is based on#15949Depends 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
@fprochazkafprochazka deleted the php7-throwable branchMay 23, 2016 13:31
@fabpotfabpot mentioned this pull requestMay 26, 2016
nicolas-grekas added a commit that referenced this pull requestMay 30, 2016
This PR was squashed before being merged into the 2.3 branch (closes#18812).Discussion----------Catch \Throwable| Q             | A| ------------- | ---| Branch?       | 2.3, 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/aRelated#18765,#15949Commits-------893cf00 Catch \Throwable
This was referencedJun 6, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@fprochazka@stof@nicolas-grekas@xabbuh@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp