Skip to content

[BUG] sharedMaxAge calculation problem a page with one of the s-max-age is null #18160

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

Closed
jean-pasqualini opened this issue Mar 14, 2016 · 3 comments

Comments

@jean-pasqualini
Copy link
Contributor

Symfony 2.3.16
PHP 5.4.41-0+deb7u1 (cli) (built: May 28 2015 18:22:26)

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php#L79.

In the case of a page /example-1

  • Page (s-max-age: 86400)
    • block A (s-max-age: null)
    • block B (s-max-age: 0)

The s-max-age injected by symfony in the response is not 0 but 86400.

Validation by test : php -r "var_dump(min(array(1,2,3,null, 0)));"

In the case of a page /example-2

  • Page (s-max-age: 86400)
    • block A (s-max-age: 0)
    • block B (s-max-age: null)

The s-max-age injected by symfony in the response is 0.

Validation by test : php -r "var_dump(min(array(1,2,3, 0, null)));"

@jean-pasqualini jean-pasqualini changed the title sharedMaxAge calculation problem a page with one of the s-max-age is null [BUG] sharedMaxAge calculation problem a page with one of the s-max-age is null Mar 14, 2016
@xabbuh
Copy link
Member

xabbuh commented Mar 14, 2016

In your example what do "block A" and "block B" refer to? Can you fork the Symfony Standard Edition and make the changes that are necessary to reproduce your issue? And please also make sure that the issue persists with the latest path version of Symfony 2.3 (2.3.39 which was released yesterday).

@jean-pasqualini
Copy link
Contributor Author

@xabbuh
Copy link
Member

xabbuh commented Mar 14, 2016

Thanks for providing this great reproducable example. I can confirm that the behaviour doesn't seem to be correct. Can you please check if the fix I proposed in #18164 actually fixes the problem for you?

Status: Reviewed

fabpot added a commit that referenced this issue Mar 15, 2016
…ble (xabbuh)

This PR was merged into the 2.3 branch.

Discussion
----------

[HttpKernel] set s-maxage only if all responses are cacheable

| Q             | A
| ------------- | ---
| Branch        | 2.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18160
| License       | MIT
| Doc PR        |

Commits
-------

b7d9338 set s-maxage only if all responses are cacheable
@fabpot fabpot closed this as completed Mar 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants