Commit cae30bb
committed
bug symfony#61368 [HttpKernel] Refine Vary header check to skip special handling of 'Accept-Language' when it's the only entry and '_vary_by_language' is
This PR was merged into the 6.4 branch.
Discussion
----------
[HttpKernel] Refine Vary header check to skip special handling of 'Accept-Language' when it's the only entry and '_vary_by_language' is `true` in `CacheAttributeListener`
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix symfony#61229
| License | MIT
### Summary
Refine Vary header check to skip special handling of 'Accept-Language' when it's the only entry and '_vary_by_language' is true in CacheAttributeListener
### Reason
Previously, the `CacheAttributeListener` was executed after the `ResponseListener`. When the `set_locale_from_accept_language` option is enabled in `framework.yaml`, the `ResponseListener` sets a Vary header on the response. Because `CacheAttributeListener` checks if a Vary header already exists before modifying it, its logic was being bypassed if it ran after the `ResponseListener`.
### References
* [LocaleListener](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php#L69-L76)
* [ResponseListener](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php#L55-L57)
* [CacheAttributeListener](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/HttpKernel/EventListener/CacheAttributeListener.php#L126)
Commits
-------
fa2bcbe [HttpKernel] Refine Vary header check to skip special handling of 'Accept-Language' when it's the only entry and '_vary_by_language' is `true` in `CacheAttributeListener`true in CacheAttributeListener (santysisi)File tree
2 files changed
+67
-1
lines changed- src/Symfony/Component/HttpKernel
- EventListener
- Tests/EventListener
2 files changed
+67
-1
lines changedLines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| |||
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
321 | 385 | | |
322 | 386 | | |
323 | 387 | | |
| |||
0 commit comments