-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -369,6 +369,12 @@ public function testExpire() | |||
$this->assertNull($response->headers->get('Expires'), '->expire() removes the Expires header when the response is fresh'); | |||
} | |||
|
|||
public function testNullExpireHeader() |
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 = new Response();
$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 calling expire
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.
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.
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 <!-- see https://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
Expires
header to null when creating aResponse
, thegetExpires
function returned a date instead of null.See also the comment in the PR introducing this regression.