From 44c34b720164107eb0a23229cffc50da84df1d35 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 26 Jul 2021 18:41:13 +0200 Subject: [PATCH 01/17] Update CHANGELOG for 5.2.12 --- CHANGELOG-5.2.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CHANGELOG-5.2.md b/CHANGELOG-5.2.md index f84a666111572..6fd6e10ed0911 100644 --- a/CHANGELOG-5.2.md +++ b/CHANGELOG-5.2.md @@ -7,6 +7,43 @@ in 5.2 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/v5.2.0...v5.2.1 +* 5.2.12 (2021-07-26) + + * bug #42212 [Lock] Handle lock with long key (jderusse) + * bug #42223 [Debug][ErrorHandler] Do not use the php80 polyfill (nicolas-grekas) + * bug #42207 [Console] fix table setHeaderTitle without headers (a1812) + * bug #42130 [Translation] fix fallback to Locale::getDefault() (nicolas-grekas) + * bug #42184 [Mailer] Make sure Http TransportException is not leaking (Nyholm) + * bug #42091 [Console] Run commands when implements SignalableCommandInterface without pcntl and they have'nt signals (PaolaRuby) + * bug #42150 [Form] Fix 'invalid_message' use in multiple ChoiceType (alexandre-daubois) + * bug #42183 [Notifier] Allow passing a previous throwable to exceptions (derrabus) + * bug #42182 [Notifier] Make sure Http TransportException is not leaking (Nyholm) + * bug #42173 [Messenger] [Redis] Fix auth option wrongly considered invalid (chalasr) + * bug #42174 Indicate compatibility with psr/log 2 and 3 (derrabus) + * bug #42112 [HttpFoundation] fix FileBag under PHP 8.1 (alexpott) + * bug #42131 [PhpUnitBridge] Fix composer resolution on Windows (Rainrider) + * bug #42097 [DependencyInjection] Support for intersection types (derrabus) + * bug #42114 [HttpFoundation] Fix return types of SessionHandler::gc() (derrabus) + * bug #42099 [VarDumper] Support for intersection types (derrabus) + * bug #42011 [Cache] Support decorated Dbal drivers in PdoAdapter (Jeroeny) + * bug #42068 Add a Special Case for Translating Choices in en_US_POSIX (chrisguitarguy) + * bug #42074 Fix ctype_digit deprecation (alexpott) + * bug #42084 [WebProfilerBundle] Fix the values of some CSS properties (javiereguiluz) + * bug #42079 [FrameworkBundle] Fixed file operations in Sodium vault seal (javiereguiluz) + * bug #42067 [Messenger] [Redis] Make `auth` option works (welcoMattic) + * bug #42054 [DoctrineBridge] fix setting default mapping type to attribute/annotation on php 8/7 respectively (nicolas-grekas) + * bug #42059 [Messenger] Fixed BC layer for RedeliveryStamp (Nyholm) + * bug #42049 [TwigBridge] do not render the same label id attribute twice (xabbuh) + * bug #42032 [HttpKernel] recover from failed deserializations (xabbuh) + * bug #42035 [Messenger] Fix use_notify default value for PostgreSqlConnection (tgalopin) + * bug #41990 [Lock] fix derivating semaphore from key (nicolas-grekas) + * bug #40529 [Translation] Missing translations from traits (insekticid) + * bug #41384 Fix SkippedTestSuite (jderusse) + * bug #41966 [Console] Revert "bug #41952 fix handling positional arguments" (chalasr, nicolas-grekas) + * bug #41905 [EventDispatcher] Correct the called event listener method case (JJsty1e) + * bug #41952 [Console] fix handling positional arguments (nicolas-grekas) + * bug #41887 [PhpUnitBridge] Fix deprecation handler with PHPUnit 10 (YaFou) + * 5.2.11 (2021-06-30) * bug #41893 [Filesystem] Workaround cannot dumpFile into "protected" folders on Windows (arnegroskurth) From 83014d13443f721c24093323da1854ef10fad90d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 26 Jul 2021 18:41:24 +0200 Subject: [PATCH 02/17] Update VERSION for 5.2.12 --- 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 1349060f14de7..d5f0219e56313 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -74,12 +74,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '5.2.12-DEV'; + public const VERSION = '5.2.12'; public const VERSION_ID = 50212; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 2; public const RELEASE_VERSION = 12; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '07/2021'; public const END_OF_LIFE = '07/2021'; From 17d54fd6cf70d44354c88516be579c4cf4baa43e Mon Sep 17 00:00:00 2001 From: mousezheng <1486145487@qq.com> Date: Mon, 26 Jul 2021 21:52:55 +0800 Subject: [PATCH 03/17] fix Check if it has session before getSession() --- .../EventListener/SessionLogoutListener.php | 4 +- .../SessionLogoutListenerTest.php | 44 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/Security/Http/Tests/EventListener/SessionLogoutListenerTest.php diff --git a/src/Symfony/Component/Security/Http/EventListener/SessionLogoutListener.php b/src/Symfony/Component/Security/Http/EventListener/SessionLogoutListener.php index 64be8e762978a..06b84d626c89d 100644 --- a/src/Symfony/Component/Security/Http/EventListener/SessionLogoutListener.php +++ b/src/Symfony/Component/Security/Http/EventListener/SessionLogoutListener.php @@ -25,7 +25,9 @@ class SessionLogoutListener implements EventSubscriberInterface { public function onLogout(LogoutEvent $event): void { - $event->getRequest()->getSession()->invalidate(); + if ($event->getRequest()->hasSession()) { + $event->getRequest()->getSession()->invalidate(); + } } public static function getSubscribedEvents(): array diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/SessionLogoutListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/SessionLogoutListenerTest.php new file mode 100644 index 0000000000000..97ede787e88c4 --- /dev/null +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/SessionLogoutListenerTest.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Tests\EventListener; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\Security\Http\Event\LogoutEvent; +use Symfony\Component\Security\Http\EventListener\SessionLogoutListener; + +class SessionLogoutListenerTest extends TestCase +{ + public function testOnLogoutIfHasNoSession() + { + $request = $this->createMock(Request::class); + $request->method('hasSession')->willReturn(false); + $request->expects($this->never())->method('getSession'); + + $sessionLogoutListener = new SessionLogoutListener(); + $sessionLogoutListener->onLogout(new LogoutEvent($request, null)); + } + + public function testOnLogoutIfHasSession() + { + $session = $this->createMock(Session::class); + $session->expects($this->once())->method('invalidate'); + + $request = $this->createMock(Request::class); + $request->method('getSession')->willReturn($session); + $request->method('hasSession')->willReturn(true); + + $sessionLogoutListener = new SessionLogoutListener(); + $sessionLogoutListener->onLogout(new LogoutEvent($request, null)); + } +} From 98447a97ce3e7e0653ba258d1f89513256bfc333 Mon Sep 17 00:00:00 2001 From: Rodolfo Ruiz Date: Mon, 26 Jul 2021 18:56:02 -0700 Subject: [PATCH 04/17] HtmlDumper - setDumpHeader accepts null --- src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index c8dedcc63f42d..6c3abaa2bf6e5 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -117,7 +117,7 @@ public function setDisplayOptions(array $displayOptions) /** * Sets an HTML header that will be dumped once in the output stream. */ - public function setDumpHeader(string $header) + public function setDumpHeader(?string $header) { $this->dumpHeader = $header; } From 5e56b360c1fc35de6256633ff149cc27474e27a6 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 27 Jul 2021 06:31:28 +0200 Subject: [PATCH 05/17] Update CHANGELOG for 4.4.28 --- CHANGELOG-4.4.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG-4.4.md b/CHANGELOG-4.4.md index 51296d5ce65cb..b1baa0f18dd9f 100644 --- a/CHANGELOG-4.4.md +++ b/CHANGELOG-4.4.md @@ -7,6 +7,10 @@ in 4.4 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/v4.4.0...v4.4.1 +* 4.4.28 (2021-07-27) + + * bug #42270 [WebProfilerBundle] [WebProfiler] "empty" filter bugfix. Filter with name "empty" is not … (luzrain) + * 4.4.27 (2021-07-26) * bug #42212 [Lock] Handle lock with long key (jderusse) From 0afeac3f51850e7763b9bd1526799b4a2b6f4a20 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 27 Jul 2021 06:31:34 +0200 Subject: [PATCH 06/17] Update VERSION for 4.4.28 --- 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 08ee0db83d722..df0874eb9edc2 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '4.4.28-DEV'; + public const VERSION = '4.4.28'; public const VERSION_ID = 40428; public const MAJOR_VERSION = 4; public const MINOR_VERSION = 4; public const RELEASE_VERSION = 28; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2022'; public const END_OF_LIFE = '11/2023'; From 1ab8a0e6787f37bd35c4e9d238d738c70a25ebbc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 27 Jul 2021 06:35:01 +0200 Subject: [PATCH 07/17] Bump Symfony version to 4.4.29 --- 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 df0874eb9edc2..9ffc2a3ee49fd 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '4.4.28'; - public const VERSION_ID = 40428; + public const VERSION = '4.4.29-DEV'; + public const VERSION_ID = 40429; public const MAJOR_VERSION = 4; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 28; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 29; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '11/2022'; public const END_OF_LIFE = '11/2023'; From 70b7a08dc39b897405dacaf9c4747e22ae6df069 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 27 Jul 2021 06:35:46 +0200 Subject: [PATCH 08/17] Update CHANGELOG for 5.2.13 --- CHANGELOG-5.2.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG-5.2.md b/CHANGELOG-5.2.md index 6fd6e10ed0911..b3ee27e04730b 100644 --- a/CHANGELOG-5.2.md +++ b/CHANGELOG-5.2.md @@ -7,6 +7,10 @@ in 5.2 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/v5.2.0...v5.2.1 +* 5.2.13 (2021-07-27) + + * bug #42270 [WebProfilerBundle] [WebProfiler] "empty" filter bugfix. Filter with name "empty" is not … (luzrain) + * 5.2.12 (2021-07-26) * bug #42212 [Lock] Handle lock with long key (jderusse) From 0c6b9d81a3d88cdb000628b5599a99d971b00537 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 27 Jul 2021 06:35:52 +0200 Subject: [PATCH 09/17] Update VERSION for 5.2.13 --- src/Symfony/Component/HttpKernel/Kernel.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index d5f0219e56313..2d3bd723e864f 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -74,11 +74,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '5.2.12'; - public const VERSION_ID = 50212; + public const VERSION = '5.2.13'; + public const VERSION_ID = 50213; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 2; - public const RELEASE_VERSION = 12; + public const RELEASE_VERSION = 13; public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '07/2021'; From 0df74c633ce80e102379334a4ffd505616cac619 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 27 Jul 2021 06:42:52 +0200 Subject: [PATCH 10/17] Bump Symfony version to 5.3.6 --- 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 00ee243724438..2d718f35e78c0 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -75,12 +75,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '5.3.5'; - public const VERSION_ID = 50305; + public const VERSION = '5.3.6-DEV'; + public const VERSION_ID = 50306; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 3; - public const RELEASE_VERSION = 5; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 6; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '01/2022'; public const END_OF_LIFE = '01/2022'; From dbc28d045dab8265970a6a04253c961deb20a755 Mon Sep 17 00:00:00 2001 From: aetxebeste Date: Tue, 27 Jul 2021 08:29:08 +0200 Subject: [PATCH 11/17] missing translations for basque --- .../Security/Core/Resources/translations/security.eu.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.eu.xlf | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.eu.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.eu.xlf index d957ceee29904..cfcdd1b02c44d 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.eu.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.eu.xlf @@ -70,6 +70,14 @@ Invalid or expired login link. Sartzeko esteka baliogabea edo iraungia. + + Too many failed login attempts, please try again in %minutes% minute. + Saioa hasteko huts gehiegi egin dira, saiatu berriro minutu %minutes% geroago. + + + Too many failed login attempts, please try again in %minutes% minutes. + Saioa hasteko huts gehiegi egin dira, saiatu berriro %minutes% minututan. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf index 802cd45fbd3bf..ec58c60369be2 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf @@ -386,6 +386,10 @@ This value is not a valid International Securities Identification Number (ISIN). Balio hori ez da baliozko baloreen nazioarteko identifikazio-zenbaki bat (ISIN). + + This value should be a valid expression. + Balio hori baliozko adierazpena izan beharko litzateke. + From 31591c36970e1ba9e064a3382f258b49c700f1c9 Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Tue, 27 Jul 2021 13:26:46 +0200 Subject: [PATCH 12/17] [HttpFoundation] Fixed type mismatch --- src/Symfony/Component/HttpFoundation/Response.php | 2 +- src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index a9cea09b39f05..e6b913f416508 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -311,7 +311,7 @@ public function prepare(Request $request) } // Check if we need to send extra expire info headers - if ('1.0' == $this->getProtocolVersion() && str_contains($headers->get('Cache-Control'), 'no-cache')) { + if ('1.0' == $this->getProtocolVersion() && str_contains($headers->get('Cache-Control', ''), 'no-cache')) { $headers->set('pragma', 'no-cache'); $headers->set('expires', -1); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index f26302eef1120..d4b8812d99c21 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -578,6 +578,12 @@ public function testPrepareSetsPragmaOnHttp10Only() $this->assertEquals('no-cache', $response->headers->get('pragma')); $this->assertEquals('-1', $response->headers->get('expires')); + $response = new Response('foo'); + $response->headers->remove('cache-control'); + $response->prepare($request); + $this->assertFalse($response->headers->has('pragma')); + $this->assertFalse($response->headers->has('expires')); + $request->server->set('SERVER_PROTOCOL', 'HTTP/1.1'); $response = new Response('foo'); $response->prepare($request); From 08ecbf5712b861263f8c400b72b5744acfd4bbd8 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Tue, 27 Jul 2021 18:14:06 +0200 Subject: [PATCH 13/17] Remove polyfills from Yaml and Dotenv Signed-off-by: Alexander M. Turek --- src/Symfony/Component/Dotenv/Dotenv.php | 10 +++++----- src/Symfony/Component/Dotenv/composer.json | 3 +-- .../Component/Yaml/Command/LintCommand.php | 4 ++-- src/Symfony/Component/Yaml/Dumper.php | 4 ++-- .../Yaml/Exception/ParseException.php | 2 +- src/Symfony/Component/Yaml/Inline.php | 16 +++++++-------- src/Symfony/Component/Yaml/Parser.php | 20 +++++++++---------- src/Symfony/Component/Yaml/composer.json | 3 +-- 8 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php index 09e847cb9e25f..57128b4ec73f4 100644 --- a/src/Symfony/Component/Dotenv/Dotenv.php +++ b/src/Symfony/Component/Dotenv/Dotenv.php @@ -135,7 +135,7 @@ public function populate(array $values, bool $overrideExistingVars = false): voi $loadedVars = array_flip(explode(',', $_SERVER['SYMFONY_DOTENV_VARS'] ?? $_ENV['SYMFONY_DOTENV_VARS'] ?? '')); foreach ($values as $name => $value) { - $notHttpName = !str_starts_with($name, 'HTTP_'); + $notHttpName = 0 !== strpos($name, 'HTTP_'); // don't check existence with getenv() because of thread safety issues if (!isset($loadedVars[$name]) && (!$overrideExistingVars && (isset($_ENV[$name]) || (isset($_SERVER[$name]) && $notHttpName)))) { continue; @@ -372,7 +372,7 @@ private function skipEmptyLines() private function resolveCommands(string $value, array $loadedVars): string { - if (!str_contains($value, '$')) { + if (false === strpos($value, '$')) { return $value; } @@ -408,7 +408,7 @@ private function resolveCommands(string $value, array $loadedVars): string $env = []; foreach ($this->values as $name => $value) { - if (isset($loadedVars[$name]) || (!isset($_ENV[$name]) && !(isset($_SERVER[$name]) && !str_starts_with($name, 'HTTP_')))) { + if (isset($loadedVars[$name]) || (!isset($_ENV[$name]) && !(isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')))) { $env[$name] = $value; } } @@ -426,7 +426,7 @@ private function resolveCommands(string $value, array $loadedVars): string private function resolveVariables(string $value, array $loadedVars): string { - if (!str_contains($value, '$')) { + if (false === strpos($value, '$')) { return $value; } @@ -461,7 +461,7 @@ private function resolveVariables(string $value, array $loadedVars): string $value = $this->values[$name]; } elseif (isset($_ENV[$name])) { $value = $_ENV[$name]; - } elseif (isset($_SERVER[$name]) && !str_starts_with($name, 'HTTP_')) { + } elseif (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) { $value = $_SERVER[$name]; } elseif (isset($this->values[$name])) { $value = $this->values[$name]; diff --git a/src/Symfony/Component/Dotenv/composer.json b/src/Symfony/Component/Dotenv/composer.json index 037d039f4a921..a6f7fdd7904aa 100644 --- a/src/Symfony/Component/Dotenv/composer.json +++ b/src/Symfony/Component/Dotenv/composer.json @@ -16,8 +16,7 @@ } ], "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" + "php": ">=7.1.3" }, "require-dev": { "symfony/process": "^3.4.2|^4.0|^5.0" diff --git a/src/Symfony/Component/Yaml/Command/LintCommand.php b/src/Symfony/Component/Yaml/Command/LintCommand.php index 7971decc00ac9..98eb8e15c4106 100644 --- a/src/Symfony/Component/Yaml/Command/LintCommand.php +++ b/src/Symfony/Component/Yaml/Command/LintCommand.php @@ -163,7 +163,7 @@ private function displayTxt(SymfonyStyle $io, array $filesInfo): int $io->text(' ERROR '.($info['file'] ? sprintf(' in %s', $info['file']) : '')); $io->text(sprintf(' >> %s', $info['message'])); - if (str_contains($info['message'], 'PARSE_CUSTOM_TAGS')) { + if (false !== strpos($info['message'], 'PARSE_CUSTOM_TAGS')) { $suggestTagOption = true; } } @@ -188,7 +188,7 @@ private function displayJson(SymfonyStyle $io, array $filesInfo): int ++$errors; } - if (isset($v['message']) && str_contains($v['message'], 'PARSE_CUSTOM_TAGS')) { + if (isset($v['message']) && false !== strpos($v['message'], 'PARSE_CUSTOM_TAGS')) { $v['message'] .= ' Use the --parse-tags option if you want parse custom tags.'; } }); diff --git a/src/Symfony/Component/Yaml/Dumper.php b/src/Symfony/Component/Yaml/Dumper.php index 866634a8a7cff..dcb104ccff065 100644 --- a/src/Symfony/Component/Yaml/Dumper.php +++ b/src/Symfony/Component/Yaml/Dumper.php @@ -68,7 +68,7 @@ public function dump($input, int $inline = 0, int $indent = 0, int $flags = 0): $output .= "\n"; } - if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && str_contains($value, "\n") && !str_contains($value, "\r")) { + if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r")) { // If the first line starts with a space character, the spec requires a blockIndicationIndicator // http://www.yaml.org/spec/1.2/spec.html#id2793979 $blockIndentationIndicator = (' ' === substr($value, 0, 1)) ? (string) $this->indentation : ''; @@ -97,7 +97,7 @@ public function dump($input, int $inline = 0, int $indent = 0, int $flags = 0): if ($value instanceof TaggedValue) { $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag()); - if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && str_contains($value->getValue(), "\n") && !str_contains($value->getValue(), "\r\n")) { + if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) { // If the first line starts with a space character, the spec requires a blockIndicationIndicator // http://www.yaml.org/spec/1.2/spec.html#id2793979 $blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : ''; diff --git a/src/Symfony/Component/Yaml/Exception/ParseException.php b/src/Symfony/Component/Yaml/Exception/ParseException.php index 268586ef2719e..82c05a714f4fb 100644 --- a/src/Symfony/Component/Yaml/Exception/ParseException.php +++ b/src/Symfony/Component/Yaml/Exception/ParseException.php @@ -114,7 +114,7 @@ private function updateRepr() $this->message = $this->rawMessage; $dot = false; - if (str_ends_with($this->message, '.')) { + if ('.' === substr($this->message, -1)) { $this->message = substr($this->message, 0, -1); $dot = true; } diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index afd6449d7d9b6..62fad41cd828e 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -377,7 +377,7 @@ private static function parseSequence(string $sequence, int $flags, int &$i = 0, $value = self::parseScalar($sequence, $flags, [',', ']'], $i, null === $tag, $references); // the value can be an array if a reference has been resolved to an array var - if (\is_string($value) && !$isQuoted && str_contains($value, ': ')) { + if (\is_string($value) && !$isQuoted && false !== strpos($value, ': ')) { // embedded mapping? try { $pos = 0; @@ -565,7 +565,7 @@ private static function evaluateScalar(string $scalar, int $flags, array &$refer $scalar = trim($scalar); $scalarLower = strtolower($scalar); - if (str_starts_with($scalar, '*')) { + if (0 === strpos($scalar, '*')) { if (false !== $pos = strpos($scalar, '#')) { $value = substr($scalar, 1, $pos - 2); } else { @@ -595,11 +595,11 @@ private static function evaluateScalar(string $scalar, int $flags, array &$refer return false; case '!' === $scalar[0]: switch (true) { - case str_starts_with($scalar, '!!str '): + case 0 === strpos($scalar, '!!str '): return (string) substr($scalar, 6); - case str_starts_with($scalar, '! '): + case 0 === strpos($scalar, '! '): return substr($scalar, 2); - case str_starts_with($scalar, '!php/object'): + case 0 === strpos($scalar, '!php/object'): if (self::$objectSupport) { if (!isset($scalar[12])) { return false; @@ -613,7 +613,7 @@ private static function evaluateScalar(string $scalar, int $flags, array &$refer } return null; - case str_starts_with($scalar, '!php/const'): + case 0 === strpos($scalar, '!php/const'): if (self::$constantSupport) { if (!isset($scalar[11])) { return ''; @@ -631,9 +631,9 @@ private static function evaluateScalar(string $scalar, int $flags, array &$refer } return null; - case str_starts_with($scalar, '!!float '): + case 0 === strpos($scalar, '!!float '): return (float) substr($scalar, 8); - case str_starts_with($scalar, '!!binary '): + case 0 === strpos($scalar, '!!binary '): return self::evaluateBinaryScalar(substr($scalar, 9)); default: throw new ParseException(sprintf('The string "%s" could not be parsed as it uses an unsupported built-in tag.', $scalar), self::$parsedLineNumber, $scalar, self::$parsedFilename); diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 472e9681ba46d..32e6d34fe17cb 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -170,7 +170,7 @@ private function doParse(string $value, int $flags) } // array - if (isset($values['value']) && str_starts_with(ltrim($values['value'], ' '), '-')) { + if (isset($values['value']) && 0 === strpos(ltrim($values['value'], ' '), '-')) { // Inline first child $currentLineNumber = $this->getRealCurrentLineNb(); @@ -179,7 +179,7 @@ private function doParse(string $value, int $flags) $sequenceYaml .= "\n".$this->getNextEmbedBlock($sequenceIndentation, true); $data[] = $this->parseBlock($currentLineNumber, rtrim($sequenceYaml), $flags); - } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || str_starts_with(ltrim($values['value'], ' '), '#')) { + } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true) ?? '', $flags); } elseif (null !== $subTag = $this->getLineTag(ltrim($values['value'], ' '), $flags)) { $data[] = new TaggedValue( @@ -211,7 +211,7 @@ private function doParse(string $value, int $flags) } } elseif ( self::preg_match('#^(?P(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|(?:!?!php/const:)?[^ \'"\[\{!].*?)) *\:(( |\t)++(?P.+))?$#u', rtrim($this->currentLine), $values) - && (!str_contains($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"])) + && (false === strpos($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"])) ) { if ($context && 'sequence' == $context) { throw new ParseException('You cannot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $this->filename); @@ -306,7 +306,7 @@ private function doParse(string $value, int $flags) $subTag = null; if ($mergeNode) { // Merge keys - } elseif (!isset($values['value']) || '' === $values['value'] || str_starts_with($values['value'], '#') || (null !== $subTag = $this->getLineTag($values['value'], $flags)) || '<<' === $key) { + } elseif (!isset($values['value']) || '' === $values['value'] || 0 === strpos($values['value'], '#') || (null !== $subTag = $this->getLineTag($values['value'], $flags)) || '<<' === $key) { // hash // if next line is less indented or equal, then it means that the current value is null if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) { @@ -453,7 +453,7 @@ private function doParse(string $value, int $flags) throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } - if (str_contains($line, ': ')) { + if (false !== strpos($line, ': ')) { @trigger_error('Support for mapping keys in multi-line blocks is deprecated since Symfony 4.3 and will throw a ParseException in 5.0.', \E_USER_DEPRECATED); } @@ -463,7 +463,7 @@ private function doParse(string $value, int $flags) $value .= ' '; } - if ('' !== trim($line) && str_ends_with($line, '\\')) { + if ('' !== trim($line) && '\\' === substr($line, -1)) { $value .= ltrim(substr($line, 0, -1)); } elseif ('' !== trim($line)) { $value .= trim($line); @@ -472,7 +472,7 @@ private function doParse(string $value, int $flags) if ('' === trim($line)) { $previousLineWasNewline = true; $previousLineWasTerminatedWithBackslash = false; - } elseif (str_ends_with($line, '\\')) { + } elseif ('\\' === substr($line, -1)) { $previousLineWasNewline = false; $previousLineWasTerminatedWithBackslash = true; } else { @@ -716,7 +716,7 @@ private function moveToPreviousLine(): bool */ private function parseValue(string $value, int $flags, string $context) { - if (str_starts_with($value, '*')) { + if (0 === strpos($value, '*')) { if (false !== $pos = strpos($value, '#')) { $value = substr($value, 1, $pos - 2); } else { @@ -803,7 +803,7 @@ private function parseValue(string $value, int $flags, string $context) $parsedValue = Inline::parse($value, $flags, $this->refs); - if ('mapping' === $context && \is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && str_contains($parsedValue, ': ')) { + if ('mapping' === $context && \is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && false !== strpos($parsedValue, ': ')) { throw new ParseException('A colon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $value, $this->filename); } @@ -1073,7 +1073,7 @@ private function isNextLineUnIndentedCollection(): bool */ private function isStringUnIndentedCollectionItem(): bool { - return '-' === rtrim($this->currentLine) || str_starts_with($this->currentLine, '- '); + return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- '); } /** diff --git a/src/Symfony/Component/Yaml/composer.json b/src/Symfony/Component/Yaml/composer.json index cb4c1f264dbef..10120348a67fc 100644 --- a/src/Symfony/Component/Yaml/composer.json +++ b/src/Symfony/Component/Yaml/composer.json @@ -17,8 +17,7 @@ ], "require": { "php": ">=7.1.3", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-ctype": "~1.8" }, "require-dev": { "symfony/console": "^3.4|^4.0|^5.0" From 09e7d6fd3cc0f4f0bb67df2c7c8e345cada32324 Mon Sep 17 00:00:00 2001 From: Benjamin Rosenberger Date: Tue, 27 Jul 2021 09:13:26 +0200 Subject: [PATCH 14/17] [Console] Readd missing php-doc parameter for constructor --- src/Symfony/Component/Console/Input/InputOption.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Console/Input/InputOption.php b/src/Symfony/Component/Console/Input/InputOption.php index c40e0da3445fa..c7729db20b8f4 100644 --- a/src/Symfony/Component/Console/Input/InputOption.php +++ b/src/Symfony/Component/Console/Input/InputOption.php @@ -48,9 +48,11 @@ class InputOption private $description; /** - * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int|null $mode The option mode: One of the VALUE_* constants - * @param string|bool|int|float|array|null $default The default value (must be null for self::VALUE_NONE) + * @param string $name The option name + * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the VALUE_* constants + * @param string $description A description text + * @param string|bool|int|float|array|null $default The default value (must be null for self::VALUE_NONE) * * @throws InvalidArgumentException If option mode is invalid or incompatible */ From 9c6d31a008c2e0b5cf9a3122620bb39c5501d475 Mon Sep 17 00:00:00 2001 From: Ruben Jansen Date: Wed, 28 Jul 2021 12:51:46 +0200 Subject: [PATCH 15/17] [Mailer] Fixed decode exception when sendgrid response is 202 --- .../Sendgrid/Transport/SendgridApiTransport.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Mailer/Bridge/Sendgrid/Transport/SendgridApiTransport.php b/src/Symfony/Component/Mailer/Bridge/Sendgrid/Transport/SendgridApiTransport.php index 14d841ac18a25..0134a6ff5ef7f 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendgrid/Transport/SendgridApiTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Sendgrid/Transport/SendgridApiTransport.php @@ -54,15 +54,18 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e try { $statusCode = $response->getStatusCode(); - $result = $response->toArray(false); - } catch (DecodingExceptionInterface $e) { - throw new HttpTransportException('Unable to send an email: '.$response->getContent(false).sprintf(' (code %d).', $statusCode), $response); } catch (TransportExceptionInterface $e) { throw new HttpTransportException('Could not reach the remote Sendgrid server.', $response, 0, $e); } if (202 !== $statusCode) { - throw new HttpTransportException('Unable to send an email: '.implode('; ', array_column($result['errors'], 'message')).sprintf(' (code %d).', $statusCode), $response); + try { + $result = $response->toArray(false); + + throw new HttpTransportException('Unable to send an email: '.implode('; ', array_column($result['errors'], 'message')).sprintf(' (code %d).', $statusCode), $response); + } catch (DecodingExceptionInterface $e) { + throw new HttpTransportException('Unable to send an email: '.$response->getContent(false).sprintf(' (code %d).', $statusCode), $response); + } } $sentMessage->setMessageId($response->getHeaders(false)['x-message-id'][0]); From c9441969b764e0869f6efb44d5f2949895c97e0a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 29 Jul 2021 09:06:21 +0200 Subject: [PATCH 16/17] Update CHANGELOG for 5.3.6 --- CHANGELOG-5.3.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG-5.3.md b/CHANGELOG-5.3.md index 2c38dab5ba2c1..76537968a1c3c 100644 --- a/CHANGELOG-5.3.md +++ b/CHANGELOG-5.3.md @@ -7,6 +7,14 @@ in 5.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/v5.3.0...v5.3.1 +* 5.3.6 (2021-07-29) + + * bug #42307 [Mailer] Fixed decode exception when sendgrid response is 202 (rubanooo) + * bug #42296 [Dotenv][Yaml] Remove PHP 8.0 polyfill (derrabus) + * bug #42274 [VarDumper] `HtmlDumper::setDumpHeader()` accepts `null` (rrpadilla) + * bug #42289 [HttpFoundation] Fixed type mismatch (Toflar) + * bug #42259 [Security] fix Check if it has session before getSession() (mousezheng) + * 5.3.5 (2021-07-27) * bug #42270 [WebProfilerBundle] [WebProfiler] "empty" filter bugfix. Filter with name "empty" is not … (luzrain) From db86819e6c652e5a45fcee338776877aeb5c11c2 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 29 Jul 2021 09:06:27 +0200 Subject: [PATCH 17/17] Update VERSION for 5.3.6 --- 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 2d718f35e78c0..0d0332d21703f 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -75,12 +75,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '5.3.6-DEV'; + public const VERSION = '5.3.6'; public const VERSION_ID = 50306; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 3; public const RELEASE_VERSION = 6; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '01/2022'; public const END_OF_LIFE = '01/2022';