Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Response]getMaxAge() returns non-negative integer#48880
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
carsonbot commentedJan 5, 2023
Hey! Thanks for your PR. You are targeting branch "6.3" but it seems your PR description refers to branch "5.4". Cheers! Carsonbot |
| $response->headers->set('Cache-Control','must-revalidate'); | ||
| $response->headers->set('Expires', -1); | ||
| $this->assertLessThanOrEqual(time() -2 *86400,$response->getExpires()->format('U')); | ||
| $this->assertSame(0,$response->getMaxAge()); |
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.
The test was forgetMaxAge() however in this case it was testinggetExpires(), which seemed wrong.
pkruithof commentedJan 5, 2023
There is a failing test for It seems to me that a negative TTL is illogical the same way as a negative |
fabpot commentedJan 5, 2023
I supposeI would expect |
pkruithof commentedJan 9, 2023
Agreed, I've changed the |
src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
pkruithof commentedJan 17, 2023
Apologies for the review requests, they were done automatically when I made a rebase mistake. The tests for 8.0 and 8.1 fail, but I am having trouble finding out why. I did a composer install inside a docker container and ran the tests there but then I got a different (unrelated) failing test, while the test that is failing in the build did pass there. Any help here would be appreciated. |
fabpot 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.
All failing tests seem unrelated to your changes.
fabpot commentedJan 18, 2023
Went too fast. This one seems relate (on low-deps): |
getMaxAge() returns non-negative integerpkruithof commentedJan 18, 2023
I noticed that too, the only way that should be possible is if the This gave the following problem: To get around this I temporarily removed the custom repo path for the runtime component (it is not related in any way to this change). Then it did install the dependencies, and the test runs without issues: So I'm not sure what to do now? |
pkruithof commentedJan 31, 2023
@fabpot could you point me in the right direction to move this PR forward? |
lyrixx commentedJan 31, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Wohoo. Thanks@pkruithof I hit the very same bug (not so easy to find ; especially if you have a reverse proxy in front of it (HTTP/1.0 vs HTTP/1.1). Your bug report is excellent. I tested your PR and it fixes my issue too. Note: in our case, with nginx as a proxy, the max age was negative |
fabpot commentedFeb 2, 2023
@pkruithof The problem is that your change impacts 2 components (which are independent). To fix the issue, you should bump the minimum version of HttpFoundation in the HttpKernel composer.json file. Right now, it's |
Uh oh!
There was an error while loading.Please reload this page.
fabpot commentedFeb 4, 2023
Thank you@pkruithof. |
The
max-agedirective should be a non-negative integer, seeMDN:In case the value is negative, it's encouraged to be treated as 0:
In my case, it lead to a response that was
private,no-cachebut with anExpiresheader set in the future. Not every browser handled this inconsistency the same, which eventually led to authentication issues (see linked comment for a more elaborate explanation).