Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
| $this->assertNull($response->headers->get('Expires'),'->expire() removes the Expires header when the response is fresh'); | ||
| } | ||
| publicfunctiontestNullExpireHeader() |
There was a problem hiding this comment.
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')
There was a problem hiding this comment.
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.
nicolas-grekas left a comment
There was a problem hiding this 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.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedAug 29, 2019
Thank you@danrot. |
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
This PR fixes a regression introduces in#33332. If you set the
Expiresheader to null when creating aResponse, thegetExpiresfunction returned a date instead of null.See alsothe comment in the PR introducing this regression.