From 75ff86811f137f5980513e9c3edb59c530f78633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 17 Oct 2020 21:11:34 +0200 Subject: [PATCH 1/6] [HttpFoundation] Fix for virtualhosts based on URL path --- .../Component/HttpFoundation/Request.php | 12 ++++++-- .../HttpFoundation/Tests/RequestTest.php | 30 +++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 7387fce74b..14775fdef3 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1848,9 +1848,15 @@ class Request } $basename = basename($baseUrl); - if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri), $basename)) { - // no match whatsoever; set it blank - return ''; + if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri).'/', '/'.$basename.'/')) { + // strip autoindex filename, for virtualhost based on URL path + $baseUrl = \dirname($baseUrl).'/'; + + $basename = basename($baseUrl); + if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri).'/', '/'.$basename.'/')) { + // no match whatsoever; set it blank + return ''; + } } // If using mod_rewrite or ISAPI_Rewrite strip the script filename diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 7c53ec2d53..ef15ea8eff 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1763,6 +1763,36 @@ class RequestTest extends TestCase '/foo', '/bar+baz', ], + [ + '/sub/foo/bar', + [ + 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php', + 'SCRIPT_NAME' => '/foo/app.php', + 'PHP_SELF' => '/foo/app.php', + ], + '/sub/foo', + '/bar', + ], + [ + '/sub/foo/app.php/bar', + [ + 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php', + 'SCRIPT_NAME' => '/foo/app.php', + 'PHP_SELF' => '/foo/app.php', + ], + '/sub/foo/app.php', + '/bar', + ], + [ + '/sub/foo/bar/baz', + [ + 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app2.phpx', + 'SCRIPT_NAME' => '/foo/app2.phpx', + 'PHP_SELF' => '/foo/app2.phpx', + ], + '/sub/foo', + '/bar/baz', + ], ]; } From 4cb7dec3479e1c253f7c209dacc57fbcd4f9df05 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Thu, 12 Nov 2020 23:51:07 +0100 Subject: [PATCH 2/6] [Validator] Resolve IsinValidator's dependency on the validator. --- .../Validator/Constraints/IsinValidator.php | 13 +------------ .../Tests/Constraints/IsinValidatorTest.php | 8 ++++---- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/IsinValidator.php b/src/Symfony/Component/Validator/Constraints/IsinValidator.php index 9ae31acb14..d5e4d9dbc9 100644 --- a/src/Symfony/Component/Validator/Constraints/IsinValidator.php +++ b/src/Symfony/Component/Validator/Constraints/IsinValidator.php @@ -15,7 +15,6 @@ use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedValueException; -use Symfony\Component\Validator\Validator\ValidatorInterface; /** * @author Laurent Masforné @@ -24,16 +23,6 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; */ class IsinValidator extends ConstraintValidator { - /** - * @var ValidatorInterface - */ - private $validator; - - public function __construct(ValidatorInterface $validator) - { - $this->validator = $validator; - } - /** * {@inheritdoc} */ @@ -87,6 +76,6 @@ class IsinValidator extends ConstraintValidator } $number = implode('', $characters); - return 0 === $this->validator->validate($number, new Luhn())->count(); + return 0 === $this->context->getValidator()->validate($number, new Luhn())->count(); } } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IsinValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IsinValidatorTest.php index 0822fb5ad6..0a219401bc 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/IsinValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/IsinValidatorTest.php @@ -4,16 +4,14 @@ namespace Symfony\Component\Validator\Tests\Constraints; use Symfony\Component\Validator\Constraints\Isin; use Symfony\Component\Validator\Constraints\IsinValidator; +use Symfony\Component\Validator\Constraints\Luhn; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; -use Symfony\Component\Validator\ValidatorBuilder; class IsinValidatorTest extends ConstraintValidatorTestCase { protected function createValidator() { - $validatorBuilder = new ValidatorBuilder(); - - return new IsinValidator($validatorBuilder->getValidator()); + return new IsinValidator(); } public function testNullIsValid() @@ -36,6 +34,7 @@ class IsinValidatorTest extends ConstraintValidatorTestCase public function testValidIsin($isin) { $this->validator->validate($isin, new Isin()); + $this->expectViolationsAt(0, $isin, new Luhn()); $this->assertNoViolation(); } @@ -103,6 +102,7 @@ class IsinValidatorTest extends ConstraintValidatorTestCase */ public function testIsinWithValidFormatButIncorrectChecksum($isin) { + $this->expectViolationsAt(0, $isin, new Luhn()); $this->assertViolationRaised($isin, Isin::INVALID_CHECKSUM_ERROR); } From 38145232ab98a1ce0834a6fc8bc2831b437439ab Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 13 Nov 2020 12:10:43 +0100 Subject: [PATCH 3/6] fix firebase transport factory DI tag type --- .../FrameworkBundle/Resources/config/notifier_transports.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.xml index 045eb52a1b..42a4f5183f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.xml @@ -35,7 +35,7 @@ - + From 4e45d2da3bd74d00d40697805b58c656d000fd85 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Fri, 13 Nov 2020 13:20:22 +0100 Subject: [PATCH 4/6] Update ExceptionEvent.php --- src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php b/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php index 3dae0d4ce6..313a3615b2 100644 --- a/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php +++ b/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php @@ -18,7 +18,7 @@ namespace Symfony\Component\HttpKernel\Event; * current request. The propagation of this event is stopped as soon as a * response is set. * - * You can also call setException() to replace the thrown exception. This + * You can also call setThrowable() to replace the thrown exception. This * exception will be thrown if no response is set during processing of this * event. * From ec80507468ba76687af8721e14ba6da78bbc41c6 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Wed, 11 Nov 2020 23:53:20 +0100 Subject: [PATCH 5/6] [Browserkit] Add changelog entry for request parameters string cast --- src/Symfony/Component/BrowserKit/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Symfony/Component/BrowserKit/CHANGELOG.md b/src/Symfony/Component/BrowserKit/CHANGELOG.md index 323166a3d6..8506ad8efe 100644 --- a/src/Symfony/Component/BrowserKit/CHANGELOG.md +++ b/src/Symfony/Component/BrowserKit/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +5.2.0 +----- + + * [BC BREAK] Request parameters are now casted to string in `Request::__construct()`. + 4.3.0 ----- From 5907444e81113438a3e34567be2c9651f406d582 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 14 Nov 2020 15:49:24 +0100 Subject: [PATCH 6/6] remove unreachable code --- src/Symfony/Component/Yaml/Parser.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 997de27965..e8f951a1ec 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -1181,27 +1181,6 @@ class Parser } return $value; - - for ($i = 1; isset($yaml[$i]) && $quotation !== $yaml[$i]; ++$i) { - } - - // quoted single line string - if (isset($yaml[$i]) && $quotation === $yaml[$i]) { - return $yaml; - } - - $lines = [$yaml]; - - while ($this->moveToNextLine()) { - for ($i = 1; isset($this->currentLine[$i]) && $quotation !== $this->currentLine[$i]; ++$i) { - } - - $lines[] = trim($this->currentLine); - - if (isset($this->currentLine[$i]) && $quotation === $this->currentLine[$i]) { - break; - } - } } private function lexInlineMapping(string $yaml): string