From 9e444442334fae9637ef3209bc2abddfef49e714 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 29 Jul 2022 14:23:38 +0200 Subject: [PATCH 01/11] Update VERSION for 4.4.44 --- Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel.php b/Kernel.php index 9f132dcd9a..978324f29f 100644 --- a/Kernel.php +++ b/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '4.4.44-DEV'; + public const VERSION = '4.4.44'; public const VERSION_ID = 40444; public const MAJOR_VERSION = 4; public const MINOR_VERSION = 4; public const RELEASE_VERSION = 44; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2022'; public const END_OF_LIFE = '11/2023'; From 3ec963a73fae9d938687a322e6908bf4fe9e7fcb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 29 Jul 2022 14:27:20 +0200 Subject: [PATCH 02/11] Bump Symfony version to 4.4.45 --- Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel.php b/Kernel.php index 978324f29f..3a699112e1 100644 --- a/Kernel.php +++ b/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '4.4.44'; - public const VERSION_ID = 40444; + public const VERSION = '4.4.45-DEV'; + public const VERSION_ID = 40445; public const MAJOR_VERSION = 4; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 44; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 45; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '11/2022'; public const END_OF_LIFE = '11/2023'; From 4fd590a2ef3f62560dbbf6cea511995dd77321ee Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 29 Jul 2022 14:30:22 +0200 Subject: [PATCH 03/11] Update VERSION for 5.4.11 --- Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel.php b/Kernel.php index ddfb2ec6d8..358b926460 100644 --- a/Kernel.php +++ b/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static $freshCache = []; - public const VERSION = '5.4.11-DEV'; + public const VERSION = '5.4.11'; public const VERSION_ID = 50411; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 4; public const RELEASE_VERSION = 11; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2024'; public const END_OF_LIFE = '11/2025'; From 628f67714b9ca6316546607c690af6d2d41884d8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 29 Jul 2022 14:36:18 +0200 Subject: [PATCH 04/11] Bump Symfony version to 5.4.12 --- Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel.php b/Kernel.php index 358b926460..266492171b 100644 --- a/Kernel.php +++ b/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static $freshCache = []; - public const VERSION = '5.4.11'; - public const VERSION_ID = 50411; + public const VERSION = '5.4.12-DEV'; + public const VERSION_ID = 50412; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 11; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 12; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '11/2024'; public const END_OF_LIFE = '11/2025'; From 961268a36f3fa4bda9fde1400d2ae7004318b717 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 29 Jul 2022 14:37:40 +0200 Subject: [PATCH 05/11] Update VERSION for 6.0.11 --- Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel.php b/Kernel.php index 231a8ab98b..238b96c60b 100644 --- a/Kernel.php +++ b/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static array $freshCache = []; - public const VERSION = '6.0.11-DEV'; + public const VERSION = '6.0.11'; public const VERSION_ID = 60011; public const MAJOR_VERSION = 6; public const MINOR_VERSION = 0; public const RELEASE_VERSION = 11; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '01/2023'; public const END_OF_LIFE = '01/2023'; From f8ccdb633e087d2ffba264959d94bba2395d5ea1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 29 Jul 2022 14:58:40 +0200 Subject: [PATCH 06/11] Bump Symfony version to 6.0.12 --- Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel.php b/Kernel.php index 238b96c60b..8b3106f5b9 100644 --- a/Kernel.php +++ b/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static array $freshCache = []; - public const VERSION = '6.0.11'; - public const VERSION_ID = 60011; + public const VERSION = '6.0.12-DEV'; + public const VERSION_ID = 60012; public const MAJOR_VERSION = 6; public const MINOR_VERSION = 0; - public const RELEASE_VERSION = 11; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 12; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '01/2023'; public const END_OF_LIFE = '01/2023'; From f1831fe259131c6cd6383a4252b7b3a2daf0f912 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 29 Jul 2022 15:07:33 +0200 Subject: [PATCH 07/11] Bump Symfony version to 6.1.4 --- Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel.php b/Kernel.php index 29c7aac081..b36b18c3a6 100644 --- a/Kernel.php +++ b/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static array $freshCache = []; - public const VERSION = '6.1.3'; - public const VERSION_ID = 60103; + public const VERSION = '6.1.4-DEV'; + public const VERSION_ID = 60104; public const MAJOR_VERSION = 6; public const MINOR_VERSION = 1; - public const RELEASE_VERSION = 3; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 4; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '01/2023'; public const END_OF_LIFE = '01/2023'; From ee9a83aa1f7e248ce58352578fe9fa646febf4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sama=C3=ABl=20Villette?= Date: Wed, 10 Aug 2022 09:21:11 +0200 Subject: [PATCH 08/11] [HttpKernel] Fix passing `null` to `\trim()` method in LoggerDataCollector --- DataCollector/LoggerDataCollector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DataCollector/LoggerDataCollector.php b/DataCollector/LoggerDataCollector.php index 15094fdbed..2bbd2a039e 100644 --- a/DataCollector/LoggerDataCollector.php +++ b/DataCollector/LoggerDataCollector.php @@ -144,7 +144,7 @@ public function getFilters() $allChannels = []; foreach ($this->getProcessedLogs() as $log) { - if ('' === trim($log['channel'])) { + if ('' === trim($log['channel'] ?? '')) { continue; } From 7dee7f02bf99c0b537d88441e31d719bc2923c42 Mon Sep 17 00:00:00 2001 From: Antonio Pauletich Date: Sun, 14 Aug 2022 02:40:10 +0200 Subject: [PATCH 09/11] Do not send deleted session cookie twice in the response --- EventListener/AbstractSessionListener.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/EventListener/AbstractSessionListener.php b/EventListener/AbstractSessionListener.php index d0e8f45d03..4603052e93 100644 --- a/EventListener/AbstractSessionListener.php +++ b/EventListener/AbstractSessionListener.php @@ -158,6 +158,11 @@ public function onKernelResponse(ResponseEvent $event) $isSessionEmpty = $session->isEmpty() && empty($_SESSION); // checking $_SESSION to keep compatibility with native sessions if ($requestSessionCookieId && $isSessionEmpty) { + // PHP internally sets the session cookie value to "deleted" when setcookie() is called with empty string $value argument + // which happens in \Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler::destroy + // when the session gets invalidated (for example on logout) so we must handle this case here too + // otherwise we would send two Set-Cookie headers back with the response + SessionUtils::popSessionCookie($sessionName, 'deleted'); $response->headers->clearCookie( $sessionName, $sessionCookiePath, From 15baea58ba30612f3a72fb9da05883c18ee9a078 Mon Sep 17 00:00:00 2001 From: Warxcell Date: Mon, 22 Aug 2022 18:00:58 +0300 Subject: [PATCH 10/11] Fix RequestStack state if throwable is thrown --- HttpKernel.php | 6 +++--- Tests/HttpKernelTest.php | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/HttpKernel.php b/HttpKernel.php index 0ed82d777b..d53b80665b 100644 --- a/HttpKernel.php +++ b/HttpKernel.php @@ -76,6 +76,7 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ { $request->headers->set('X-Php-Ob-Level', (string) ob_get_level()); + $this->requestStack->push($request); try { return $this->handleRaw($request, $type); } catch (\Exception $e) { @@ -89,6 +90,8 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ } return $this->handleThrowable($e, $request, $type); + } finally { + $this->requestStack->pop(); } } @@ -127,8 +130,6 @@ public function terminateWithException(\Throwable $exception, Request $request = */ private function handleRaw(Request $request, int $type = self::MASTER_REQUEST): Response { - $this->requestStack->push($request); - // request $event = new RequestEvent($this, $request, $type); $this->dispatcher->dispatch($event, KernelEvents::REQUEST); @@ -205,7 +206,6 @@ private function filterResponse(Response $response, Request $request, int $type) private function finishRequest(Request $request, int $type) { $this->dispatcher->dispatch(new FinishRequestEvent($this, $request, $type), KernelEvents::FINISH_REQUEST); - $this->requestStack->pop(); } /** diff --git a/Tests/HttpKernelTest.php b/Tests/HttpKernelTest.php index 014dc752c3..53e5f547d2 100644 --- a/Tests/HttpKernelTest.php +++ b/Tests/HttpKernelTest.php @@ -39,6 +39,45 @@ public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue() $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); } + public function testRequestStackIsNotBrokenWhenControllerThrowsAnExceptionAndCatchIsTrue() + { + $requestStack = new RequestStack(); + $kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \RuntimeException(); }, $requestStack); + + try { + $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); + } catch (\Throwable $exception) { + } + + self::assertNull($requestStack->getCurrentRequest()); + } + + public function testRequestStackIsNotBrokenWhenControllerThrowsAnExceptionAndCatchIsFalse() + { + $requestStack = new RequestStack(); + $kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \RuntimeException(); }, $requestStack); + + try { + $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, false); + } catch (\Throwable $exception) { + } + + self::assertNull($requestStack->getCurrentRequest()); + } + + public function testRequestStackIsNotBrokenWhenControllerThrowsAnThrowable() + { + $requestStack = new RequestStack(); + $kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \Error(); }, $requestStack); + + try { + $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); + } catch (\Throwable $exception) { + } + + self::assertNull($requestStack->getCurrentRequest()); + } + public function testHandleWhenControllerThrowsAnExceptionAndCatchIsFalseAndNoListenerIsRegistered() { $this->expectException(\RuntimeException::class); From 2144c53a278254af57fa1e6f71427be656fab6f4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 26 Aug 2022 16:50:30 +0200 Subject: [PATCH 11/11] Update VERSION for 6.1.4 --- Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel.php b/Kernel.php index b36b18c3a6..ec49d1a018 100644 --- a/Kernel.php +++ b/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static array $freshCache = []; - public const VERSION = '6.1.4-DEV'; + public const VERSION = '6.1.4'; public const VERSION_ID = 60104; public const MAJOR_VERSION = 6; public const MINOR_VERSION = 1; public const RELEASE_VERSION = 4; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '01/2023'; public const END_OF_LIFE = '01/2023';