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

[HttpKernel][FrameworkBundle] Turn HTTP exceptions to HTTP status codes by default#27519

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

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedJun 6, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#25844
LicenseMIT
Doc PR-

When an exception is thrown,if it is not handled then it will be reinjected as a 2nd exception event viaHttpKernel::terminateWithException(). When this happens, this will generate a proper HTTP status code.

dominikzogg and rvanlaak reacted with thumbs up emoji
@nicolas-grekas
Copy link
MemberAuthor

Status: needs review

Copy link
Member

@javiereguiluzjaviereguiluz left a comment

Choose a reason for hiding this comment

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

I haven't tested it in a real app, but the code looks OK to me.

publicfunctiontestNullController()
{
$listener =newExceptionListener(null);
$kernel =$this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();

Choose a reason for hiding this comment

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

->getMockBuilder(HttpKernelInterface::class)->

private$isTerminating =false;

publicfunction__construct($controller,LoggerInterface$logger =null,$debug =false)
publicfunction__construct($controller,LoggerInterface$logger =null,$debug =false,$charset =null,$fileLinkFormat =null)
Copy link
Member

Choose a reason for hiding this comment

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

string $charset = null

@dominikzogg
Copy link

@nicolas-grekas thanks, would be cool if you would backport this to all affected versions (3.4, 4.x)

@nicolas-grekas
Copy link
MemberAuthor

comments addressed thanks

@nicolas-grekas
Copy link
MemberAuthor

more comments @symfony/deciders ?

@nicolas-grekasnicolas-grekas merged commit80b0739 intosymfony:masterJul 7, 2018
nicolas-grekas added a commit that referenced this pull requestJul 7, 2018
…HTTP status codes by default (nicolas-grekas)This PR was merged into the 4.2-dev branch.Discussion----------[HttpKernel][FrameworkBundle] Turn HTTP exceptions to HTTP status codes by default| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#25844| License       | MIT| Doc PR        | -When an exception is thrown, *if it is not handled* then it will be reinjected as a 2nd exception event via `HttpKernel::terminateWithException()`. When this happens, this will generate a proper HTTP status code.Commits-------80b0739 [HttpKernel][FrameworkBundle] Turn HTTP exceptions to HTTP status codes by default
@nicolas-grekasnicolas-grekas deleted the kernel-http-x branchJuly 7, 2018 16:05
if (!$event->isMasterRequest()) {
return;
}
if (!$this->isTerminating) {
Copy link
MemberAuthor

@nicolas-grekasnicolas-grekasJun 5, 2019
edited
Loading

Choose a reason for hiding this comment

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

for the record, the state managed by this property ensures that we don't break apps that handle exceptions outside of the stack:

try {$kernel->handle($request);}catch (SomeException$e) {// ...}

as required e.g. in some framework migration strategies.
As hinted in the PR description, this allows running the fallback exception logic only when no catch block stopped the bubbling, interminateWithException.

nicolas-grekas added a commit to nicolas-grekas/symfony that referenced this pull requestJun 5, 2019
nicolas-grekas added a commit to nicolas-grekas/symfony that referenced this pull requestJun 5, 2019
fabpot added a commit that referenced this pull requestJun 5, 2019
…las-grekas)This PR was merged into the 4.2 branch.Discussion----------[HttpKernel] Fix handling non-catchable fatal errors| Q             | A| ------------- | ---| Branch?       | 4.3| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -This reverts PR#27519 this commit18c2dde,reversing changes made toac1189a.Right now, the listener is skipped on fatal errors.Commits-------a1619cc [HttpKernel] Fix handling non-catchable fatal errors
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@chalasrchalasrchalasr left review comments

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

6 participants

@nicolas-grekas@dominikzogg@javiereguiluz@stof@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp