From 30444a88e0828791a239b03b73544bd40f650c5c Mon Sep 17 00:00:00 2001 From: Fritz Michael Gschwantner Date: Thu, 14 Jul 2022 10:28:41 +0100 Subject: [PATCH 1/3] fix deprecation --- src/Symfony/Component/HttpFoundation/InputBag.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/InputBag.php b/src/Symfony/Component/HttpFoundation/InputBag.php index e8daeeeb59d38..d520bbc8d60d9 100644 --- a/src/Symfony/Component/HttpFoundation/InputBag.php +++ b/src/Symfony/Component/HttpFoundation/InputBag.php @@ -35,8 +35,8 @@ public function get(string $key, $default = null) $value = parent::get($key, $this); - if (null !== $value && $this !== $value && !\is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { - trigger_deprecation('symfony/http-foundation', '5.1', 'Retrieving a non-string value from "%s()" is deprecated, and will throw a "%s" exception in Symfony 6.0, use "%s::all($key)" instead.', __METHOD__, BadRequestException::class, __CLASS__); + if (null !== $value && $this !== $value && !\is_scalar($value)) { + trigger_deprecation('symfony/http-foundation', '5.1', 'Retrieving a non-scalar value from "%s()" is deprecated, and will throw a "%s" exception in Symfony 6.0, use "%s::all($key)" instead.', __METHOD__, BadRequestException::class, __CLASS__); } return $this === $value ? $default : $value; From de23ac86aa4ea181c5d24279c94d9924c1abbdcd Mon Sep 17 00:00:00 2001 From: fritzmg Date: Thu, 14 Jul 2022 10:48:07 +0100 Subject: [PATCH 2/3] also fix the test --- src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php index 6031fe6540204..b21e988a4a8b0 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php @@ -72,10 +72,10 @@ public function testSetWithNonScalarOrArrayIsDeprecated() /** * @group legacy */ - public function testGettingANonStringValueIsDeprecated() + public function testGettingANonScalarValueIsDeprecated() { $bag = new InputBag(['foo' => ['a', 'b']]); - $this->expectDeprecation('Since symfony/http-foundation 5.1: Retrieving a non-string value from "Symfony\Component\HttpFoundation\InputBag::get()" is deprecated, and will throw a "Symfony\Component\HttpFoundation\Exception\BadRequestException" exception in Symfony 6.0, use "Symfony\Component\HttpFoundation\InputBag::all($key)" instead.'); + $this->expectDeprecation('Since symfony/http-foundation 5.1: Retrieving a non-scalar value from "Symfony\Component\HttpFoundation\InputBag::get()" is deprecated, and will throw a "Symfony\Component\HttpFoundation\Exception\BadRequestException" exception in Symfony 6.0, use "Symfony\Component\HttpFoundation\InputBag::all($key)" instead.'); $bag->get('foo'); } From 6245bac3bd88bef692737de82aeaf27806a003da Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Fri, 15 Jul 2022 18:22:04 +0200 Subject: [PATCH 3/3] Revert removal of Stringable check --- src/Symfony/Component/HttpFoundation/InputBag.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/InputBag.php b/src/Symfony/Component/HttpFoundation/InputBag.php index d520bbc8d60d9..a9d3cd82af8f0 100644 --- a/src/Symfony/Component/HttpFoundation/InputBag.php +++ b/src/Symfony/Component/HttpFoundation/InputBag.php @@ -35,7 +35,7 @@ public function get(string $key, $default = null) $value = parent::get($key, $this); - if (null !== $value && $this !== $value && !\is_scalar($value)) { + if (null !== $value && $this !== $value && !\is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { trigger_deprecation('symfony/http-foundation', '5.1', 'Retrieving a non-scalar value from "%s()" is deprecated, and will throw a "%s" exception in Symfony 6.0, use "%s::all($key)" instead.', __METHOD__, BadRequestException::class, __CLASS__); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy