From 30970c7a9b475c888f65980347df98cbe5c3fc94 Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Wed, 2 May 2018 00:50:12 +0200 Subject: [PATCH 1/3] [Validator] make phpdoc of ObjectInitializerInterface interface more accurate --- src/Symfony/Component/Validator/ObjectInitializerInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/ObjectInitializerInterface.php b/src/Symfony/Component/Validator/ObjectInitializerInterface.php index dcbc2cd11d..5f9cdad879 100644 --- a/src/Symfony/Component/Validator/ObjectInitializerInterface.php +++ b/src/Symfony/Component/Validator/ObjectInitializerInterface.php @@ -15,7 +15,7 @@ namespace Symfony\Component\Validator; * Prepares an object for validation. * * Concrete implementations of this interface are used by {@link ValidationVisitorInterface} - * to initialize objects just before validating them. + * and {@link Validator\ContextualValidatorInterface} to initialize objects just before validating them. * * @author Fabien Potencier * @author Bernhard Schussek From b11dccebd2781447ba0e9c852aa3e4549d82ec9b Mon Sep 17 00:00:00 2001 From: Valentin Udaltsov Date: Sun, 6 May 2018 17:23:59 +0300 Subject: [PATCH 2/3] Fixed typo RecursiveIterator -> RecursiveIteratorIterator --- src/Symfony/Component/Form/Util/InheritDataAwareIterator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php b/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php index ba157b7d18..a400c16f0b 100644 --- a/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php +++ b/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php @@ -17,7 +17,7 @@ namespace Symfony\Component\Form\Util; * Contrary to \ArrayIterator, this iterator recognizes changes in the original * array during iteration. * - * You can wrap the iterator into a {@link \RecursiveIterator} in order to + * You can wrap the iterator into a {@link \RecursiveIteratorIterator} in order to * enter any child form that inherits its parent's data and iterate the children * of that form as well. * From ae62d9bc811b011d68ef8a6e88b2df21d8a7a4a5 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 3 May 2018 14:15:36 +0200 Subject: [PATCH 3/3] use brace-style regex delimiters --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- .../HttpFoundation/Tests/RequestTest.php | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index ecdcdbc25a..e1309d477b 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -581,7 +581,7 @@ class Request public static function setTrustedHosts(array $hostPatterns) { self::$trustedHostPatterns = array_map(function ($hostPattern) { - return sprintf('#%s#i', $hostPattern); + return sprintf('{%s}i', $hostPattern); }, $hostPatterns); // we need to reset trusted hosts on trusted host patterns change self::$trustedHosts = array(); diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 0c5451dfd6..688a7c714a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -18,6 +18,11 @@ use Symfony\Component\HttpFoundation\Request; class RequestTest extends TestCase { + protected function tearDown() + { + Request::setTrustedHosts(array()); + } + public function testInitialize() { $request = new Request(); @@ -1871,9 +1876,15 @@ class RequestTest extends TestCase $request->headers->set('host', 'subdomain.trusted.com'); $this->assertEquals('subdomain.trusted.com', $request->getHost()); + } - // reset request for following tests - Request::setTrustedHosts(array()); + public function testSetTrustedHostsDoesNotBreakOnSpecialCharacters() + { + Request::setTrustedHosts(array('localhost(\.local){0,1}#,example.com', 'localhost')); + + $request = Request::create('/'); + $request->headers->set('host', 'localhost'); + $this->assertSame('localhost', $request->getHost()); } public function testFactory()