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

Return null as Expire header if it was set to null#33353

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
nicolas-grekas merged 1 commit intosymfony:3.4fromdanrot:expires-header
Aug 29, 2019
Merged

Return null as Expire header if it was set to null#33353

nicolas-grekas merged 1 commit intosymfony:3.4fromdanrot:expires-header
Aug 29, 2019

Conversation

@danrot
Copy link
Contributor

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PRsymfony/symfony-docs#...

This PR fixes a regression introduces in#33332. If you set theExpires header to null when creating aResponse, thegetExpires function returned a date instead of null.

$response =newResponse(null,200, ['Expires' =>null]);$response->getExpires();// Returns a date currently, but should return null

See alsothe comment in the PR introducing this regression.

$this->assertNull($response->headers->get('Expires'),'->expire() removes the Expires header when the response is fresh');
}

publicfunctiontestNullExpireHeader()
Copy link
Contributor

Choose a reason for hiding this comment

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

Think, you'd better place this test into testExpire() method (see line 339 in this file) and use more consistent format, like this:

$response =newResponse();$response->headers->set('Expires',null);$response->expire();$this->assertNull($response->headers->get('Expires'),'Place description of expected behavior here')

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I thought about it, but this bug is not about callingexpire on the response, actually this call is not necessary at all. That's why I've decided against that, in order to keep the test minimal.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

This highlights an interesting behavior. In case anyone is wondering, this reverts to the historical behavior for values explicitly set to null.

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneAug 29, 2019
@nicolas-grekas
Copy link
Member

Thank you@danrot.

nicolas-grekas added a commit that referenced this pull requestAug 29, 2019
This PR was squashed before being merged into the 3.4 branch (closes#33353).Discussion----------Return null as Expire header if it was set to null| Q             | A| ------------- | ---| Branch?       | 3.4 <!-- see below -->| Bug fix?      | yes| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets |    <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->This PR fixes a regression introduces in#33332. If you set the `Expires` header to null when creating a `Response`, the `getExpires` function returned a date instead of null.```php$response = new Response(null, 200, ['Expires' => null]);$response->getExpires(); // Returns a date currently, but should return null```See also [the comment](#33332 (comment)) in the PR introducing this regression.Commits-------5e3c7ea Return null as Expire header if it was set to null
@nicolas-grekasnicolas-grekas merged commit5e3c7ea intosymfony:3.4Aug 29, 2019
@danrotdanrot deleted the expires-header branchAugust 29, 2019 17:36
This was referencedOct 7, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@berezuevberezuevberezuev left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

5 participants

@danrot@nicolas-grekas@berezuev@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp