From 44398fc6960c1e0c9227bda4ae8b95ff5cc744ec Mon Sep 17 00:00:00 2001 From: Enleur Date: Sat, 12 Mar 2016 21:15:46 +0700 Subject: [PATCH 01/10] minor #18088 Fix typo for profiler --- src/Symfony/Component/HttpKernel/Profiler/Profiler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php index fc539bbb12..3d6c3a2c0c 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php +++ b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php @@ -200,7 +200,7 @@ class Profiler foreach ($this->collectors as $collector) { $collector->collect($request, $response, $exception); - // forces collectors to become "read/only" (they loose their object dependencies) + // forces collectors to become "read/only" (they lose their object dependencies) $profile->addCollector(unserialize(serialize($collector))); } From f33f1929a2205f8d3e786a8e1d075b7110d32ea5 Mon Sep 17 00:00:00 2001 From: juanluisgarciaborrego Date: Sat, 12 Mar 2016 15:44:43 +0100 Subject: [PATCH 02/10] replace perfom by perform --- src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php b/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php index c62bdd4176..b871443e09 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php +++ b/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php @@ -253,7 +253,7 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf } // check properties for deleted, and created ACEs, and perform deletions - // we need to perfom deletions before updating existing ACEs, in order to + // we need to perform deletions before updating existing ACEs, in order to // preserve uniqueness of the order field if (isset($propertyChanges['classAces'])) { $this->updateOldAceProperty('classAces', $propertyChanges['classAces']); From 5e4b515f1b61c6b208d94dadd7b0824eb4548dbb Mon Sep 17 00:00:00 2001 From: Koalabaerchen Date: Sat, 12 Mar 2016 15:51:44 +0100 Subject: [PATCH 03/10] Fix for Isssue #18091 --- .../Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php b/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php index 3231b87c4f..4c306bec31 100644 --- a/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php +++ b/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php @@ -186,7 +186,7 @@ class ModelChoiceListTest extends Propel1TestCase $this->assertEquals(array(1, 2), $choiceList->getIndicesForChoices(array($item1, $item2))); } - public function testDifferentEqualObjectsAreChoosen() + public function testDifferentEqualObjectsAreChosen() { $item = new Item(1, 'Foo'); @@ -200,10 +200,10 @@ class ModelChoiceListTest extends Propel1TestCase array($item) ); - $choosenItem = new Item(1, 'Foo'); + $chosenItem = new Item(1, 'Foo'); - $this->assertEquals(array(1), $choiceList->getIndicesForChoices(array($choosenItem))); - $this->assertEquals(array('1'), $choiceList->getValuesForChoices(array($choosenItem))); + $this->assertEquals(array(1), $choiceList->getIndicesForChoices(array($chosenItem))); + $this->assertEquals(array('1'), $choiceList->getValuesForChoices(array($chosenItem))); } public function testGetIndicesForNullChoices() From 6276452592461536c75080916cc1cd259c4b75bb Mon Sep 17 00:00:00 2001 From: taiiiraaa Date: Sat, 12 Mar 2016 16:03:08 +0000 Subject: [PATCH 04/10] Fix typos #18090 1. PHPs session design to PHP's session design 2. Symfony HttpKernel offers to Symfony's HttpKernel offers 3. in which case it it should to in which case it should --- .../Session/Storage/SessionStorageInterface.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php index 9f81847a10..4b2f5d27aa 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php @@ -76,10 +76,10 @@ interface SessionStorageInterface * Note regenerate+destroy should not clear the session data in memory * only delete the session data from persistent storage. * - * Care: When regenerating the session ID no locking is involved in PHPs + * Care: When regenerating the session ID no locking is involved in PHP's * session design. See https://bugs.php.net/bug.php?id=61470 for a discussion. * So you must make sure the regenerated session is saved BEFORE sending the - * headers with the new ID. Symfonys HttpKernel offers a listener for this. + * headers with the new ID. Symfony's HttpKernel offers a listener for this. * See Symfony\Component\HttpKernel\EventListener\SaveSessionListener. * Otherwise session data could get lost again for concurrent requests with the * new ID. One result could be that you get logged out after just logging in. @@ -101,7 +101,7 @@ interface SessionStorageInterface * * This method must invoke session_write_close() unless this interface is * used for a storage object design for unit or functional testing where - * a real PHP session would interfere with testing, in which case it + * a real PHP session would interfere with testing, in which case * it should actually persist the session data if required. * * @throws \RuntimeException If the session is saved without being started, or if the session From 6af23ccaaabb0ea95063631990a5c342e35bdefc Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 13 Mar 2016 12:02:32 +0100 Subject: [PATCH 05/10] Improved the "branch" row of the PR table --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index b03e61ef33..7ed7b20e22 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch | master for features and deprecations / lowest applicable and maintained version otherwise +| Branch? | "master" for new features / 2.3, 2.7, 2.8 or 3.0 for fixes | Bug fix? | yes/no | New feature? | yes/no | BC breaks? | yes/no From dd3b333924f47b7d0692771d96ac17a6ce63edc6 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 13 Mar 2016 17:37:42 +0100 Subject: [PATCH 06/10] updated CHANGELOG for 2.3.39 --- CHANGELOG-2.3.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CHANGELOG-2.3.md b/CHANGELOG-2.3.md index 5d22ee314f..b8e185e9de 100644 --- a/CHANGELOG-2.3.md +++ b/CHANGELOG-2.3.md @@ -7,6 +7,31 @@ in 2.3 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1 +* 2.3.39 (2016-03-13) + + * bug #18080 [HttpFoundation] Set the Content-Range header if the requested Range is unsatisfied (jakzal) + * bug #18084 [HttpFoundation] Avoid warnings when checking malicious IPs (jakzal) + * bug #18048 [HttpKernel] Fix mem usage when stripping the prod container (nicolas-grekas) + * bug #18065 [Finder] Partially revert #17134 to fix a regression (jakzal) + * bug #18018 [HttpFoundation] exception when registering bags for started sessions (xabbuh) + * bug #18054 [Filesystem] Fix false positive in ->remove() (nicolas-grekas) + * bug #18049 [Validator] Fix the locale validator so it treats a locale alias as a valid locale (jakzal) + * bug #18019 [Intl] Update ICU to version 55 (jakzal) + * bug #16656 [HttpFoundation] automatically generate safe fallback filename (xabbuh) + * bug #15794 [Console] default to stderr in the console helpers (alcohol) + * bug #17984 Allow to normalize \Traversable when serializing xml (Ener-Getick) + * bug #17434 Improved the error message when a template is not found (rvanginneken, javiereguiluz) + * bug #17894 [FrameworkBundle] Fix a regression in handling absolute template paths (jakzal) + * bug #17595 [HttpKernel] Remove _path from query parameters when fragment is a subrequest (cmenning) + * bug #17986 [DomCrawler] Dont use LIBXML_PARSEHUGE by default (nicolas-grekas) + * bug #17668 add 'guid' to list of exception to filter out (garak) + * bug #17615 Ensure backend slashes for symlinks on Windows systems (cpsitgmbh) + * bug #17626 Try to delete broken symlinks (IchHabRecht) + * bug #17978 [Yaml] ensure dump indentation to be greather than zero (xabbuh) + * bug #17976 [WebProfilerBundle] fix debug toolbar rendering by removing inadvertently added links (craue) + * bug #17971 Variadic controller params (NiR-, fabpot) + * bug #17925 [Bridge] The WebProcessor now forwards the client IP (magnetik) + * 2.3.38 (2016-02-28) * bug #17947 Fix - #17676 (backport #17919 to 2.3) (Ocramius) From a5149ed96a89ea12ef61d206684a6c79c5f170ae Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 13 Mar 2016 17:37:49 +0100 Subject: [PATCH 07/10] update CONTRIBUTORS for 2.3.39 --- CONTRIBUTORS.md | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fdf163f5d8..79ca50e61c 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,8 +16,8 @@ Symfony is the result of the work of many people who made the code better - Kris Wallsmith (kriswallsmith) - Jakub Zalas (jakubzalas) - Ryan Weaver (weaverryan) - - Hugo Hamon (hhamon) - Javier Eguiluz (javier.eguiluz) + - Hugo Hamon (hhamon) - Abdellatif Ait boudad (aitboudad) - Pascal Borreli (pborreli) - Kévin Dunglas (dunglas) @@ -35,8 +35,8 @@ Symfony is the result of the work of many people who made the code better - Eriksen Costa (eriksencosta) - Sarah Khalil (saro0h) - Jonathan Wage (jwage) - - Maxime Steinhausser (ogizanagi) - Diego Saint Esteben (dosten) + - Maxime Steinhausser (ogizanagi) - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar @@ -56,12 +56,12 @@ Symfony is the result of the work of many people who made the code better - Michel Weimerskirch (mweimerskirch) - Eric Clemmons (ericclemmons) - Andrej Hudec (pulzarraider) + - Christian Raue - Matthias Pigulla (mpdude) - Peter Rehm (rpet) - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - - Christian Raue - Arnout Boks (aboks) - Douglas Greenshields (shieldo) - Lee McDermott @@ -79,16 +79,18 @@ Symfony is the result of the work of many people who made the code better - Iltar van der Berg (kjarli) - Arnaud Le Blanc (arnaud-lb) - Jérôme Tamarelle (gromnan) + - Jules Pietri (heah) - Michal Piotrowski (eventhorizon) - Tim Nagel (merk) + - Paráda József (paradajozsef) - Brice BERNARD (brikou) + - Ener-Getick (energetick) - Charles Sarrazin (csarrazi) - Alexander M. Turek (derrabus) - Dariusz Ruminski - marc.weistroff - lenar - Włodzimierz Gajda (gajdaw) - - Paráda József (paradajozsef) - Alexander Schwenn (xelaris) - Florian Voutzinos (florianv) - Colin Frei @@ -98,13 +100,12 @@ Symfony is the result of the work of many people who made the code better - Peter Kokot (maastermedia) - excelwebzone - Jacob Dreesen (jdreesen) + - Konstantin Myakshin (koc) - Jérémy DERUSSÉ (jderusse) - Vladimir Reznichenko (kalessil) - Baptiste Clavié (talus) - - Ener-Getick (energetick) - Fabien Pennequin (fabienpennequin) - Gordon Franke (gimler) - - Konstantin Myakshin (koc) - Tomáš Votruba (tomas_votruba) - Jáchym Toušek - Robert Schönthal (digitalkaoz) @@ -117,7 +118,6 @@ Symfony is the result of the work of many people who made the code better - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) - - Jules Pietri (heah) - Evgeniy (ewgraf) - Guilherme Blanco (guilhermeblanco) - Pablo Godel (pgodel) @@ -146,6 +146,8 @@ Symfony is the result of the work of many people who made the code better - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) - Daniel Wehner + - Richard van Laak (rvanlaak) + - Possum - Dorian Villet (gnutix) - Javier Spagnoletti (phansys) - Richard Miller (mr_r_miller) @@ -154,11 +156,10 @@ Symfony is the result of the work of many people who made the code better - Benjamin Dulau (dbenjamin) - Andreas Hucks (meandmymonkey) - Noel Guilbert (noel) - - Richard van Laak (rvanlaak) + - Stepan Anchugov (kix) - bronze1man - sun (sun) - Larry Garfield (crell) - - Possum - Martin Schuhfuß (usefulthink) - Matthieu Bontemps (mbontemps) - Pierre Minnieur (pminnieur) @@ -177,7 +178,6 @@ Symfony is the result of the work of many people who made the code better - Sven Paulus (subsven) - Lars Strojny (lstrojny) - Rui Marinho (ruimarinho) - - Stepan Anchugov (kix) - Eugene Wissner - Julien Brochet (mewt) - Sergey Linnik (linniksa) @@ -186,6 +186,7 @@ Symfony is the result of the work of many people who made the code better - Titouan Galopin (tgalopin) - Loïc Faugeron - Jannik Zschiesche (apfelbox) + - Marco Pivetta (ocramius) - julien pauli (jpauli) - Michael Lee (zerustech) - Lorenz Schori @@ -265,11 +266,11 @@ Symfony is the result of the work of many people who made the code better - Bob den Otter (bopp) - Adrian Rudnik (kreischweide) - Francesc Rosàs (frosas) + - Massimiliano Arione (garak) - Julien Galenski (ruian) - Bongiraud Dominique - janschoenherr - Thomas Schulz (king2500) - - Marco Pivetta (ocramius) - Berny Cantos (xphere81) - Ricard Clau (ricardclau) - Mark Challoner (markchalloner) @@ -314,6 +315,7 @@ Symfony is the result of the work of many people who made the code better - Endre Fejes - Tobias Naumann (tna) - Shein Alexey + - Baptiste Lafontaine - Joe Lencioni - Daniel Tschinder - Kai @@ -336,7 +338,6 @@ Symfony is the result of the work of many people who made the code better - Oscar Cubo Medina (ocubom) - Karel Souffriau - Christophe L. (christophelau) - - Massimiliano Arione (garak) - Anthon Pang (robocoder) - Emanuele Gaspari (inmarelibero) - Dariusz Rumiński @@ -388,6 +389,7 @@ Symfony is the result of the work of many people who made the code better - Roman Lapin (memphys) - Yoshio HANAWA - Gladhon + - Benoît Burnichon (bburnichon) - Sebastian Bergmann - Pablo Díez (pablodip) - Kevin McBride @@ -397,6 +399,7 @@ Symfony is the result of the work of many people who made the code better - Ilya Antipenko (aivus) - Iker Ibarguren (ikerib) - Ricardo Oliveira (ricardolotr) + - Roy Van Ginneken (rvanginneken) - ondrowan - Barry vd. Heuvel (barryvdh) - Jerzy Zawadzki (jzawadzki) @@ -458,7 +461,6 @@ Symfony is the result of the work of many people who made the code better - Johnny Robeson (johnny) - Disquedur - Michiel Boeckaert (milio) - - Baptiste Lafontaine - Geoffrey Tran (geoff) - Jan Behrens - Mantas Var (mvar) @@ -514,6 +516,7 @@ Symfony is the result of the work of many people who made the code better - Luc Vieillescazes (iamluc) - Johann Saunier (prophet777) - Antoine Corcy + - Rob Bast - Artur Eshenbrener - Arturs Vonda - Sascha Grossenbacher @@ -522,6 +525,7 @@ Symfony is the result of the work of many people who made the code better - Benjamin Zikarsky (bzikarsky) - Simon Schick (simonsimcity) - redstar504 + - Tristan Roussel - Hossein Bukhamsin - Disparity - origaminal @@ -615,7 +619,6 @@ Symfony is the result of the work of many people who made the code better - Emanuele Iannone - Tony Malzhacker - Mathieu MARCHOIS - - Benoît Burnichon (bburnichon) - Cyril Quintin (cyqui) - Gerard van Helden (drm) - Johnny Peck (johnnypeck) @@ -719,17 +722,20 @@ Symfony is the result of the work of many people who made the code better - Danilo Silva - Zachary Tong (polyfractal) - Hryhorii Hrebiniuk + - mcfedr (mcfedr) - dantleech - Xavier Leune - Tero Alén (tero) - DerManoMann - Guillaume Royer - Artem (digi) + - boite - dantleech - Vadim Tyukov (vatson) - Sortex - chispita - Wojciech Sznapka + - Arjan Keeman - Máximo Cuadros (mcuadros) - tamirvs - julien.galenski @@ -807,7 +813,6 @@ Symfony is the result of the work of many people who made the code better - spdionis - Eduardo García Sanz (coma) - James Gilliland - - Roy Van Ginneken - David de Boer (ddeboer) - Gilles Doge (gido) - abulford @@ -869,6 +874,7 @@ Symfony is the result of the work of many people who made the code better - Ludek Stepan - Geoffrey Brier - Aaron Stephens (astephens) + - Craig Menning (cmenning) - Balázs Benyó (duplabe) - Erika Heidi Reinaldo (erikaheidi) - Pierre Tachoire (krichprollsch) @@ -881,6 +887,7 @@ Symfony is the result of the work of many people who made the code better - Karol Sójko (karolsojko) - sl_toto (sl_toto) - Walter Dal Mut (wdalmut) + - Albin Kerouaton - Sébastien HOUZÉ - Jingyu Wang - Daniel Espendiller @@ -900,6 +907,7 @@ Symfony is the result of the work of many people who made the code better - Daniel Richter (richtermeister) - ChrisC - Ilya Biryukov + - Kim Laï Trinh - Jason Desrosiers - m.chwedziak - Philip Frank @@ -958,7 +966,6 @@ Symfony is the result of the work of many people who made the code better - Jānis Lukss - rkerner - Alex Silcock - - Rob Bast - Matthew J Mucklo - fdgdfg (psampaz) - Stéphane Seng @@ -1024,6 +1031,7 @@ Symfony is the result of the work of many people who made the code better - Alexandre Segura - Josef Cech - Arnau González (arnaugm) + - Simon Bouland (bouland) - Nate (frickenate) - Matthew Foster (mfoster) - Paul Seiffert (seiffert) @@ -1087,16 +1095,20 @@ Symfony is the result of the work of many people who made the code better - Jordi Llonch (jordillonch) - Cédric Dugat (ph3nol) - Philip Dahlstrøm (phidah) + - Alex Rock Ancelet (pierstoval) - Milos Colakovic (project2481) - Rénald Casagraude (rcasagraude) - Robin Duval (robin-duval) - Grinbergs Reinis (shima5) - Artem Lopata (bumz) + - Nicole Cordes - Alexey Popkov - Artyom Protaskin - Nathanael d. Noblet - helmer + - ged15 - Daan van Renterghem + - Nicole Cordes - Bram Van der Sype (brammm) - Julien Moulin (lizjulien) - Nikita Nefedov (nikita2206) @@ -1316,7 +1328,6 @@ Symfony is the result of the work of many people who made the code better - Sema - Elan Ruusamäe - Thorsten Hallwas - - Tristan Roussel - Michael Squires - Norman Soetbeer - zorn @@ -1399,6 +1410,7 @@ Symfony is the result of the work of many people who made the code better - Ala Eddine Khefifi (nayzo) - emilienbouard (neime) - Nicholas Byfleet (nickbyfleet) + - Tomas Norkūnas (norkunas) - ollie harridge (ollietb) - Paul Andrieux (paulandrieux) - Paweł Szczepanek (pauluz) From 1d4f366be0d3b38ddeb3c7ad4de614d6d7e096d5 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 13 Mar 2016 17:38:02 +0100 Subject: [PATCH 08/10] updated VERSION for 2.3.39 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 0edc40b4ca..51ac51c64c 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.3.39-DEV'; + const VERSION = '2.3.39'; const VERSION_ID = 20339; const MAJOR_VERSION = 2; const MINOR_VERSION = 3; const RELEASE_VERSION = 39; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; /** * Constructor. From b7d93381a29e7d6c51651e1f48e8c45de9a0a8ee Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 14 Mar 2016 17:13:08 +0100 Subject: [PATCH 09/10] set s-maxage only if all responses are cacheable --- .../HttpCache/EsiResponseCacheStrategy.php | 12 ++- .../EsiResponseCacheStrategyTest.php | 77 +++++++++++++++++++ 2 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiResponseCacheStrategyTest.php diff --git a/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php b/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php index 4b28acff4a..23be41e501 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php @@ -32,6 +32,7 @@ class EsiResponseCacheStrategy implements EsiResponseCacheStrategyInterface private $embeddedResponses = 0; private $ttls = array(); private $maxAges = array(); + private $isNotCacheableResponseEmbedded = false; /** * {@inheritdoc} @@ -41,8 +42,13 @@ class EsiResponseCacheStrategy implements EsiResponseCacheStrategyInterface if ($response->isValidateable()) { $this->cacheable = false; } else { + $maxAge = $response->getMaxAge(); $this->ttls[] = $response->getTtl(); - $this->maxAges[] = $response->getMaxAge(); + $this->maxAges[] = $maxAge; + + if (null === $maxAge) { + $this->isNotCacheableResponseEmbedded = true; + } } ++$this->embeddedResponses; @@ -76,7 +82,9 @@ class EsiResponseCacheStrategy implements EsiResponseCacheStrategyInterface $this->ttls[] = $response->getTtl(); $this->maxAges[] = $response->getMaxAge(); - if (null !== $maxAge = min($this->maxAges)) { + if ($this->isNotCacheableResponseEmbedded) { + $response->headers->removeCacheControlDirective('s-maxage'); + } elseif (null !== $maxAge = min($this->maxAges)) { $response->setSharedMaxAge($maxAge); $response->headers->set('Age', $maxAge - min($this->ttls)); } diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiResponseCacheStrategyTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiResponseCacheStrategyTest.php new file mode 100644 index 0000000000..c70d4e71f3 --- /dev/null +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiResponseCacheStrategyTest.php @@ -0,0 +1,77 @@ + + * + * This code is partially based on the Rack-Cache library by Ryan Tomayko, + * which is released under the MIT license. + * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\HttpCache; + +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpCache\EsiResponseCacheStrategy; + +class EsiResponseCacheStrategyTest extends \PHPUnit_Framework_TestCase +{ + public function testMinimumSharedMaxAgeWins() + { + $cacheStrategy = new EsiResponseCacheStrategy(); + + $response1 = new Response(); + $response1->setSharedMaxAge(60); + $cacheStrategy->add($response1); + + $response2 = new Response(); + $response2->setSharedMaxAge(3600); + $cacheStrategy->add($response2); + + $response = new Response(); + $response->setSharedMaxAge(86400); + $cacheStrategy->update($response); + + $this->assertSame('60', $response->headers->getCacheControlDirective('s-maxage')); + } + + public function testSharedMaxAgeNotSetIfNotSetInAnyEmbeddedRequest() + { + $cacheStrategy = new EsiResponseCacheStrategy(); + + $response1 = new Response(); + $response1->setSharedMaxAge(60); + $cacheStrategy->add($response1); + + $response2 = new Response(); + $cacheStrategy->add($response2); + + $response = new Response(); + $response->setSharedMaxAge(86400); + $cacheStrategy->update($response); + + $this->assertFalse($response->headers->hasCacheControlDirective('s-maxage')); + } + + public function testSharedMaxAgeNotSetIfNotSetInMasterRequest() + { + $cacheStrategy = new EsiResponseCacheStrategy(); + + $response1 = new Response(); + $response1->setSharedMaxAge(60); + $cacheStrategy->add($response1); + + $response2 = new Response(); + $response2->setSharedMaxAge(3600); + $cacheStrategy->add($response2); + + $response = new Response(); + $cacheStrategy->update($response); + + $this->assertFalse($response->headers->hasCacheControlDirective('s-maxage')); + } +} From 8aece06d48d84d9ce2ffe655599a6ffd5de4b2a8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 14 Mar 2016 22:34:48 +0100 Subject: [PATCH 10/10] bumped Symfony version to 2.3.40 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 51ac51c64c..de7b1a46fd 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.3.39'; - const VERSION_ID = 20339; + const VERSION = '2.3.40-DEV'; + const VERSION_ID = 20340; const MAJOR_VERSION = 2; const MINOR_VERSION = 3; - const RELEASE_VERSION = 39; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 40; + const EXTRA_VERSION = 'DEV'; /** * Constructor.