From 36f5ff1550aff15ea46501532dd0e714d84defee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Sat, 5 Dec 2020 22:49:04 +0100 Subject: [PATCH 1/7] Add missing entries in gitattributes --- .../Component/Messenger/Bridge/Beanstalkd/.gitattributes | 1 + src/Symfony/Component/Notifier/Bridge/Discord/.gitattributes | 1 + .../Component/Notifier/Bridge/GoogleChat/.gitattributes | 1 + src/Symfony/Component/Notifier/Bridge/Infobip/.gitattributes | 1 + src/Symfony/Component/Notifier/Bridge/Mobyt/.gitattributes | 1 + src/Symfony/Component/Notifier/Bridge/Smsapi/.gitattributes | 1 + src/Symfony/Component/Notifier/Bridge/Zulip/.gitattributes | 1 + src/Symfony/Component/Semaphore/.gitattributes | 5 +++-- 8 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/.gitattributes b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/.gitattributes index ebb9287043..84c7add058 100644 --- a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/.gitattributes +++ b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/.gitattributes @@ -1,3 +1,4 @@ /Tests export-ignore /phpunit.xml.dist export-ignore +/.gitattributes export-ignore /.gitignore export-ignore diff --git a/src/Symfony/Component/Notifier/Bridge/Discord/.gitattributes b/src/Symfony/Component/Notifier/Bridge/Discord/.gitattributes index ebb9287043..84c7add058 100644 --- a/src/Symfony/Component/Notifier/Bridge/Discord/.gitattributes +++ b/src/Symfony/Component/Notifier/Bridge/Discord/.gitattributes @@ -1,3 +1,4 @@ /Tests export-ignore /phpunit.xml.dist export-ignore +/.gitattributes export-ignore /.gitignore export-ignore diff --git a/src/Symfony/Component/Notifier/Bridge/GoogleChat/.gitattributes b/src/Symfony/Component/Notifier/Bridge/GoogleChat/.gitattributes index ebb9287043..84c7add058 100644 --- a/src/Symfony/Component/Notifier/Bridge/GoogleChat/.gitattributes +++ b/src/Symfony/Component/Notifier/Bridge/GoogleChat/.gitattributes @@ -1,3 +1,4 @@ /Tests export-ignore /phpunit.xml.dist export-ignore +/.gitattributes export-ignore /.gitignore export-ignore diff --git a/src/Symfony/Component/Notifier/Bridge/Infobip/.gitattributes b/src/Symfony/Component/Notifier/Bridge/Infobip/.gitattributes index ebb9287043..84c7add058 100644 --- a/src/Symfony/Component/Notifier/Bridge/Infobip/.gitattributes +++ b/src/Symfony/Component/Notifier/Bridge/Infobip/.gitattributes @@ -1,3 +1,4 @@ /Tests export-ignore /phpunit.xml.dist export-ignore +/.gitattributes export-ignore /.gitignore export-ignore diff --git a/src/Symfony/Component/Notifier/Bridge/Mobyt/.gitattributes b/src/Symfony/Component/Notifier/Bridge/Mobyt/.gitattributes index ebb9287043..84c7add058 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mobyt/.gitattributes +++ b/src/Symfony/Component/Notifier/Bridge/Mobyt/.gitattributes @@ -1,3 +1,4 @@ /Tests export-ignore /phpunit.xml.dist export-ignore +/.gitattributes export-ignore /.gitignore export-ignore diff --git a/src/Symfony/Component/Notifier/Bridge/Smsapi/.gitattributes b/src/Symfony/Component/Notifier/Bridge/Smsapi/.gitattributes index ebb9287043..84c7add058 100644 --- a/src/Symfony/Component/Notifier/Bridge/Smsapi/.gitattributes +++ b/src/Symfony/Component/Notifier/Bridge/Smsapi/.gitattributes @@ -1,3 +1,4 @@ /Tests export-ignore /phpunit.xml.dist export-ignore +/.gitattributes export-ignore /.gitignore export-ignore diff --git a/src/Symfony/Component/Notifier/Bridge/Zulip/.gitattributes b/src/Symfony/Component/Notifier/Bridge/Zulip/.gitattributes index ebb9287043..84c7add058 100644 --- a/src/Symfony/Component/Notifier/Bridge/Zulip/.gitattributes +++ b/src/Symfony/Component/Notifier/Bridge/Zulip/.gitattributes @@ -1,3 +1,4 @@ /Tests export-ignore /phpunit.xml.dist export-ignore +/.gitattributes export-ignore /.gitignore export-ignore diff --git a/src/Symfony/Component/Semaphore/.gitattributes b/src/Symfony/Component/Semaphore/.gitattributes index 15f635e92c..84c7add058 100644 --- a/src/Symfony/Component/Semaphore/.gitattributes +++ b/src/Symfony/Component/Semaphore/.gitattributes @@ -1,3 +1,4 @@ -/.gitignore export-ignore -/phpunit.xml.dist export-ignore /Tests export-ignore +/phpunit.xml.dist export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore From f2dbbd2e58827761536227b291f571a5a807a74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurica=20=C5=A0eparovi=C4=87?= Date: Sat, 5 Dec 2020 15:41:42 +0100 Subject: [PATCH 2/7] Add Croatian (hr) translations --- .../Resources/translations/validators.hr.xlf | 120 ++++++++++++++++++ .../Resources/translations/security.hr.xlf | 8 ++ .../Resources/translations/validators.hr.xlf | 24 ++++ 3 files changed, 152 insertions(+) diff --git a/src/Symfony/Component/Form/Resources/translations/validators.hr.xlf b/src/Symfony/Component/Form/Resources/translations/validators.hr.xlf index 8d0bd29201..a04ab1283f 100644 --- a/src/Symfony/Component/Form/Resources/translations/validators.hr.xlf +++ b/src/Symfony/Component/Form/Resources/translations/validators.hr.xlf @@ -14,6 +14,126 @@ The CSRF token is invalid. Please try to resubmit the form. CSRF vrijednost nije ispravna. Pokušajte ponovo poslati obrazac. + + This value is not a valid HTML5 color. + Ova vrijednost nije ispravna HTML5 boja. + + + Please enter a valid birthdate. + Molim upišite ispravan datum rođenja. + + + The selected choice is invalid. + Odabrani izbor nije ispravan. + + + The collection is invalid. + Kolekcija nije ispravna. + + + Please select a valid color. + Molim odaberite ispravnu boju. + + + Please select a valid country. + Molim odaberite ispravnu državu. + + + Please select a valid currency. + Molim odaberite ispravnu valutu. + + + Please choose a valid date interval. + Molim odaberite ispravni vremenski interval. + + + Please enter a valid date and time. + Molim unesite ispravni datum i vrijeme. + + + Please enter a valid date. + Molim odaberite ispravan datum. + + + Please select a valid file. + Molim odaberite ispravnu datoteku. + + + The hidden field is invalid. + Skriveno polje nije ispravno. + + + Please enter an integer. + Molim unesite cijeli broj. + + + Please select a valid language. + Molim odaberite ispravan jezik. + + + Please select a valid locale. + Molim odaberite ispravnu lokalizaciju. + + + Please enter a valid money amount. + Molim unesite ispravan iznos novca. + + + Please enter a number. + Molim unesite broj. + + + The password is invalid. + Ova lozinka nije ispravna. + + + Please enter a percentage value. + Molim unesite vrijednost postotka. + + + The values do not match. + Ove vrijednosti se ne poklapaju. + + + Please enter a valid time. + Molim unesite ispravno vrijeme. + + + Please select a valid timezone. + Molim odaberite ispravnu vremensku zonu. + + + Please enter a valid URL. + Molim unesite ispravan URL. + + + Please enter a valid search term. + Molim unesite ispravan pojam za pretraživanje. + + + Please provide a valid phone number. + Molim navedite ispravan telefonski broj. + + + The checkbox has an invalid value. + Polje za potvrdu sadrži neispravnu vrijednost. + + + Please enter a valid email address. + Molim unesite valjanu adresu elektronske pošte. + + + Please select a valid option. + Molim odaberite ispravnu opciju. + + + Please select a valid range. + Molim odaberite ispravan raspon. + + + Please enter a valid week. + Molim unesite ispravni tjedan. + diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.hr.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.hr.xlf index 411a48572a..e193dcb500 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.hr.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.hr.xlf @@ -62,6 +62,14 @@ Account is locked. Račun je zaključan. + + Too many failed login attempts, please try again later. + Previše neuspjelih pokušaja prijave, molim pokušajte ponovo kasnije. + + + Invalid or expired login link. + Link za prijavu je isteako ili je neispravan. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf index ccc0c0135a..2d8cf7dbb9 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf @@ -362,6 +362,30 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Ova lozinka je procurila u nekom od sigurnosnih propusta, te je potrebno koristiti drugu lozinku. + + This value should be between {{ min }} and {{ max }}. + Ova vrijednost treba biti između {{ min }} i {{ max }}. + + + This value is not a valid hostname. + Ova vrijednost nije ispravno ime poslužitelja (engl. hostname). + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Broj elemenata u kolekciji treba biti djeljiv s {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Ova vrijednost mora zadovoljiti jedan od sljedećih ograničenja: + + + Each element of this collection should satisfy its own set of constraints. + Svaki element ove kolekcije mora zadovoljiti vlastiti skup ograničenja. + + + This value is not a valid International Securities Identification Number (ISIN). + Ova vrijednost nije ispravan međunarodni identifikacijski broj vrijednosnih papira (ISIN). + From ad4f6f2093d803b104aeae71358be805e2d46104 Mon Sep 17 00:00:00 2001 From: Nicolas Jourdan Date: Sun, 6 Dec 2020 03:57:44 +0100 Subject: [PATCH 3/7] [Security][Validator] Add missing Portuguese translations --- .../Resources/translations/security.pt.xlf | 8 +++ .../Resources/translations/validators.pt.xlf | 56 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.pt.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.pt.xlf index b1a4af5154..286dab2665 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.pt.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.pt.xlf @@ -62,6 +62,14 @@ Account is locked. A conta está trancada. + + Too many failed login attempts, please try again later. + Várias tentativas de login falhadas, por favor tente mais tarde. + + + Invalid or expired login link. + Ligação de login inválida ou expirada. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf index 0244ee4f39..71bdaf8bc1 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf @@ -330,6 +330,62 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. O Código de Identificação de Empresa (BIC) não está associado ao IBAN {{ iban }}. + + This value should be valid JSON. + Este valor deve ser um JSON válido. + + + This collection should contain only unique elements. + Esta coleção deve conter só elementos únicos. + + + This value should be positive. + Este valor deve ser estritamente positivo. + + + This value should be either positive or zero. + Este valor deve ser superior ou igual a zero. + + + This value should be negative. + Este valor deve ser estritamente negativo. + + + This value should be either negative or zero. + Este valor deve ser inferior ou igual a zero. + + + This value is not a valid timezone. + Este valor não é um fuso horário válido. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Esta senha foi divulgada durante uma fuga de dados, não deve ser usada de novamente. Por favor usar uma senha outra. + + + This value should be between {{ min }} and {{ max }}. + Este valor deve situar-se entre {{ min }} e {{ max }}. + + + This value is not a valid hostname. + Este valor não é um nome de host válido. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + O número de elementos desta coleção deve ser um múltiplo de {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Este valor deve satisfazer pelo menos uma das seguintes restrições : + + + Each element of this collection should satisfy its own set of constraints. + Cada elemento desta coleção deve satisfazer o seu próprio conjunto de restrições. + + + This value is not a valid International Securities Identification Number (ISIN). + Este valor não é um Número Internacional de Identificação de Segurança (ISIN) válido. + From c0dda8bd033e335e625783d57c1118b632f94ca9 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 7 Dec 2020 15:59:27 +0100 Subject: [PATCH 4/7] Fix: Remove unused sprintf() parameters --- .../Component/Notifier/Bridge/Discord/DiscordTransport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Notifier/Bridge/Discord/DiscordTransport.php b/src/Symfony/Component/Notifier/Bridge/Discord/DiscordTransport.php index 53f9cd0886..ed28695b52 100644 --- a/src/Symfony/Component/Notifier/Bridge/Discord/DiscordTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/Discord/DiscordTransport.php @@ -68,7 +68,7 @@ final class DiscordTransport extends AbstractTransport $content = $message->getSubject(); if (\strlen($content) > 2000) { - throw new LogicException(sprintf('The subject length of "%s" transport must be less than 2000 characters.', __CLASS__, ChatMessage::class, get_debug_type($message))); + throw new LogicException(sprintf('The subject length of "%s" transport must be less than 2000 characters.', __CLASS__)); } $endpoint = sprintf('https://%s/api/webhooks/%s/%s', $this->getEndpoint(), $this->webhookId, $this->token); From 37fddad0f2a211efa0c941b1c5328d4e3571f134 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 7 Dec 2020 15:56:37 +0100 Subject: [PATCH 5/7] Fix: Indentation --- .../Bridge/LinkedIn/LinkedInTransport.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Notifier/Bridge/LinkedIn/LinkedInTransport.php b/src/Symfony/Component/Notifier/Bridge/LinkedIn/LinkedInTransport.php index 4fbf958a7e..26f4801b7a 100644 --- a/src/Symfony/Component/Notifier/Bridge/LinkedIn/LinkedInTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/LinkedIn/LinkedInTransport.php @@ -97,17 +97,17 @@ final class LinkedInTransport extends AbstractTransport { return [ 'specificContent' => [ - 'com.linkedin.ugc.ShareContent' => [ - 'shareCommentary' => [ - 'attributes' => [], - 'text' => $message->getSubject(), - ], - 'shareMediaCategory' => 'NONE', - ], + 'com.linkedin.ugc.ShareContent' => [ + 'shareCommentary' => [ + 'attributes' => [], + 'text' => $message->getSubject(), ], - 'visibility' => [ - 'com.linkedin.ugc.MemberNetworkVisibility' => 'PUBLIC', + 'shareMediaCategory' => 'NONE', ], + ], + 'visibility' => [ + 'com.linkedin.ugc.MemberNetworkVisibility' => 'PUBLIC', + ], 'lifecycleState' => 'PUBLISHED', 'author' => sprintf('urn:li:person:%s', $this->accountId), ]; From 7fcba9611d4a1df277b2739e2c84ccb50604ee47 Mon Sep 17 00:00:00 2001 From: Oleg Zhulnev Date: Tue, 1 Dec 2020 18:38:38 +0300 Subject: [PATCH 6/7] [HttpFoundation] Fix TypeError: Argument 1 passed to JsonResponse::setJson() must be of the type string, object given --- .../Component/HttpFoundation/JsonResponse.php | 12 ++++-- .../HttpFoundation/Tests/JsonResponseTest.php | 38 +++++++++++++++++++ .../Component/HttpFoundation/composer.json | 3 +- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php index f6b247bfa1..79791a7233 100644 --- a/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -43,6 +43,10 @@ class JsonResponse extends Response { parent::__construct('', $status, $headers); + if ($json && !\is_string($data) && !is_numeric($data) && !\is_callable([$data, '__toString'])) { + throw new \TypeError(sprintf('"%s": If $json is set to true, argument $data must be a string or object implementing __toString(), "%s" given.', __METHOD__, get_debug_type($data))); + } + if (null === $data) { $data = new \ArrayObject(); } @@ -77,13 +81,13 @@ class JsonResponse extends Response * return JsonResponse::fromJsonString('{"key": "value"}') * ->setSharedMaxAge(300); * - * @param string|null $data The JSON response string - * @param int $status The response status code - * @param array $headers An array of response headers + * @param string $data The JSON response string + * @param int $status The response status code + * @param array $headers An array of response headers * * @return static */ - public static function fromJsonString($data = null, $status = 200, $headers = []) + public static function fromJsonString($data, $status = 200, $headers = []) { return new static($data, $status, $headers, true); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php index 0468ebd594..8c37fd771b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php @@ -240,6 +240,44 @@ class JsonResponseTest extends TestCase $this->assertEquals('/**/ಠ_ಠ["foo"].bar[0]({"foo":"bar"});', $response->getContent()); } + + public function testConstructorWithNullAsDataThrowsAnUnexpectedValueException() + { + $this->expectException(\TypeError::class); + $this->expectExceptionMessage('If $json is set to true, argument $data must be a string or object implementing __toString(), "null" given.'); + + new JsonResponse(null, 200, [], true); + } + + public function testfromJsonStringConstructorWithNullAsDataThrowsAnUnexpectedValueException() + { + $this->expectException(\TypeError::class); + $this->expectExceptionMessage('If $json is set to true, argument $data must be a string or object implementing __toString(), "null" given.'); + + JsonResponse::fromJsonString(null); + } + + public function testConstructorWithObjectWithToStringMethod() + { + $class = new class() { + public function __toString() + { + return '{}'; + } + }; + + $response = new JsonResponse($class, 200, [], true); + + $this->assertSame('{}', $response->getContent()); + } + + public function testConstructorWithObjectWithoutToStringMethodThrowsAnException() + { + $this->expectException(\TypeError::class); + $this->expectExceptionMessage('If $json is set to true, argument $data must be a string or object implementing __toString(), "stdClass" given.'); + + new JsonResponse(new \stdClass(), 200, [], true); + } } if (interface_exists('JsonSerializable', false)) { diff --git a/src/Symfony/Component/HttpFoundation/composer.json b/src/Symfony/Component/HttpFoundation/composer.json index 79f4b396d0..7b3a692bd6 100644 --- a/src/Symfony/Component/HttpFoundation/composer.json +++ b/src/Symfony/Component/HttpFoundation/composer.json @@ -18,7 +18,8 @@ "require": { "php": ">=7.1.3", "symfony/mime": "^4.3|^5.0", - "symfony/polyfill-mbstring": "~1.1" + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php80": "^1.15" }, "require-dev": { "predis/predis": "~1.0", From 2807a7950d76b17ed6b56bbf425790a0f62bf947 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Mon, 7 Dec 2020 23:31:01 +0100 Subject: [PATCH 7/7] [HttpFoundation] Removed obsolete test. --- .../Component/HttpFoundation/Tests/JsonResponseTest.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php index 165c05284a..c0bbd83029 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php @@ -276,14 +276,6 @@ class JsonResponseTest extends TestCase new JsonResponse(null, 200, [], true); } - public function testfromJsonStringConstructorWithNullAsDataThrowsAnUnexpectedValueException() - { - $this->expectException(\TypeError::class); - $this->expectExceptionMessage('If $json is set to true, argument $data must be a string or object implementing __toString(), "null" given.'); - - JsonResponse::fromJsonString(null); - } - public function testConstructorWithObjectWithToStringMethod() { $class = new class() {