This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Fabien Potencier e50db1f93f bug #35305 [HttpKernel] Fix stale-if-error behavior, add tests (mpdude)
This PR was squashed before being merged into the 3.4 branch (closes #35305).

Discussion
----------

[HttpKernel] Fix stale-if-error behavior, add tests

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #24248
| License       | MIT
| Doc PR        |

This PR adds the first tests for `stale-if-error` logic in `HttpCache`.

It also fixes an observation from #24248: For responses that have been cached as `public` with an `ETag` but without a lifetime, in case of an error the stale response will be served forever (= as long as the error persists), even beyond the configured `stale-if-error` grace period.

Furthermore, it tries to improve compliance with RFC 7234: Stale responses must not be sent (under no condition) if one of
* `no-cache`
* `must-revalidate`
* `proxy-revalidate` or
* `s-maxage` (sic) is present.

This can be found in the corresponding chapters of Section 5.2.2 for these directives, but is also summarized in [Section 4.2.4](https://tools.ietf.org/html/rfc7234#section-4.2.4) as

 > A cache MUST NOT generate a stale response if it is prohibited by an explicit in-protocol directive (e.g., by a "no-store" or "no-cache" cache directive, a "must-revalidate" cache-response-directive, or an applicable "s-maxage" or "proxy-revalidate" cache-response-directive; see Section 5.2.2).

Because disabling of `stale-if-error` for `s-maxage` responses probably has a big impact on the usefulness of that feature in practice, it has to be enabled explicitly with a new config setting `strict_smaxage` (defaulting to `false`).

Commits
-------

ad5f427bed [HttpKernel] Fix stale-if-error behavior, add tests
2020-01-30 17:05:58 +01:00
.github Fix PR template 2019-11-17 22:52:25 +01:00
src/Symfony bug #35305 [HttpKernel] Fix stale-if-error behavior, add tests (mpdude) 2020-01-30 17:05:58 +01:00
.appveyor.yml [CI] fix building local packages 2019-10-15 14:09:56 +02:00
.editorconfig Update .editorconfig 2018-09-06 16:22:56 +02:00
.gitignore Run the phpunit-bridge from a PR 2019-08-02 17:46:19 +02:00
.php_cs.dist Simplify PHP CS Fixer configuration 2019-11-03 15:37:51 +01:00
.travis.yml Fix testing with mongodb 2020-01-23 11:22:55 +01:00
CHANGELOG-3.0.md Merge branch '2.8' into 3.1 2016-08-05 10:37:39 +02:00
CHANGELOG-3.1.md updated CHANGELOG for 3.1.9 2017-01-12 12:43:31 -08:00
CHANGELOG-3.2.md use behavior instead of behaviour 2019-03-25 08:48:46 +01:00
CHANGELOG-3.3.md use behavior instead of behaviour 2019-03-25 08:48:46 +01:00
CHANGELOG-3.4.md updated CHANGELOG for 3.4.37 2020-01-21 13:29:39 +01:00
CODE_OF_CONDUCT.md Added the Code of Conduct file 2018-10-10 03:13:30 -07:00
composer.json Add conflict rule for Monolog 2. 2019-11-17 14:23:03 +01:00
CONTRIBUTING.md Mention the community review guide 2016-12-18 22:02:35 +01:00
CONTRIBUTORS.md update CONTRIBUTORS for 3.4.37 2020-01-21 13:29:48 +01:00
LICENSE Update year in license files 2020-01-01 12:03:25 +01:00
link Allow copy instead of symlink for ./link script 2019-12-02 15:51:37 +01:00
phpunit Ignore deprecations about doctrine/persistence coming from doctrine/orm 2019-12-16 13:38:17 +01:00
phpunit.xml.dist Merge branch '2.8' into 3.4 2018-11-11 20:48:54 +01:00
README.md Improve Symfony description 2019-11-24 19:17:45 +01:00
UPGRADE-3.0.md Fixed markdown file 2019-08-13 19:39:09 +02:00
UPGRADE-3.1.md [Serializer] Remove AbstractObjectNormalizer::isAttributeToNormalize 2016-12-08 16:02:32 +01:00
UPGRADE-3.2.md Merge branch '2.8' into 3.4 2018-02-22 13:28:57 +01:00
UPGRADE-3.3.md Merge branch '3.3' into 3.4 2017-11-30 15:59:23 +01:00
UPGRADE-3.4.md Merge branch '2.8' into 3.4 2018-05-31 12:13:22 +02:00
UPGRADE-4.0.md Link the right file depending on the new version 2019-11-16 09:59:33 +01:00

Symfony is a PHP framework for web and console applications and a set of reusable PHP components. Symfony is used by thousands of web applications (including BlaBlaCar.com and Spotify.com) and most of the popular PHP projects (including Drupal and Magento).

Installation

Documentation

Community

Contributing

Symfony is an Open Source, community-driven project with thousands of contributors. Join them contributing code or contributing documentation.

Security Issues

If you discover a security vulnerability within Symfony, please follow our disclosure procedure.

About Us

Symfony development is sponsored by SensioLabs, led by the Symfony Core Team and supported by Symfony contributors.