From 9807f06ff15097240542562f47711405a1a11cee Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Wed, 2 Nov 2016 15:14:20 +0100 Subject: [PATCH 1/9] Request: throw dedicted exceptions. --- .../Exception/AbstractHostException.php | 43 +++++++++++++++++++ .../Exception/ConflictingHeadersException.php | 2 +- .../Exception/ExceptionInterface.php | 21 +++++++++ .../Exception/InvalidHostException.php | 21 +++++++++ .../InvalidTrustedHeaderException.php | 37 ++++++++++++++++ .../Exception/UntrustedHostException.php | 21 +++++++++ .../Component/HttpFoundation/Request.php | 31 ++++++++----- .../HttpFoundation/Tests/RequestTest.php | 7 +-- 8 files changed, 169 insertions(+), 14 deletions(-) create mode 100644 src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php create mode 100644 src/Symfony/Component/HttpFoundation/Exception/ExceptionInterface.php create mode 100644 src/Symfony/Component/HttpFoundation/Exception/InvalidHostException.php create mode 100644 src/Symfony/Component/HttpFoundation/Exception/InvalidTrustedHeaderException.php create mode 100644 src/Symfony/Component/HttpFoundation/Exception/UntrustedHostException.php diff --git a/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php b/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php new file mode 100644 index 0000000000000..1e48e879c9fed --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Exception; + +/** + * THe HTTP request contains incorrect host data. + * + * @author SpacePossum + */ +abstract class AbstractHostException extends \UnexpectedValueException implements ExceptionInterface +{ + /** + * @var string + */ + private $host; + + /** + * @param string $host + * @param string $message + */ + public function __construct($host, $message) + { + parent::__construct($message); + $this->host = $host; + } + + /** + * @return string + */ + public function getHost() + { + return $this->host; + } +} diff --git a/src/Symfony/Component/HttpFoundation/Exception/ConflictingHeadersException.php b/src/Symfony/Component/HttpFoundation/Exception/ConflictingHeadersException.php index fa5f1c7873270..1cdb1b9803231 100644 --- a/src/Symfony/Component/HttpFoundation/Exception/ConflictingHeadersException.php +++ b/src/Symfony/Component/HttpFoundation/Exception/ConflictingHeadersException.php @@ -18,6 +18,6 @@ * * @author Magnus Nordlander */ -class ConflictingHeadersException extends \RuntimeException +class ConflictingHeadersException extends \UnexpectedValueException implements ExceptionInterface { } diff --git a/src/Symfony/Component/HttpFoundation/Exception/ExceptionInterface.php b/src/Symfony/Component/HttpFoundation/Exception/ExceptionInterface.php new file mode 100644 index 0000000000000..dc7caad3d99f4 --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Exception; + +/** + * Base ExceptionInterface for the Request component. + * + * @author SpacePossum + */ +interface ExceptionInterface +{ +} diff --git a/src/Symfony/Component/HttpFoundation/Exception/InvalidHostException.php b/src/Symfony/Component/HttpFoundation/Exception/InvalidHostException.php new file mode 100644 index 0000000000000..636f84f66be47 --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Exception/InvalidHostException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Exception; + +/** + * The HTTP request contains invalid host data. + * + * @author SpacePossum + */ +final class InvalidHostException extends AbstractHostException +{ +} diff --git a/src/Symfony/Component/HttpFoundation/Exception/InvalidTrustedHeaderException.php b/src/Symfony/Component/HttpFoundation/Exception/InvalidTrustedHeaderException.php new file mode 100644 index 0000000000000..6a0457c8f525f --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Exception/InvalidTrustedHeaderException.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Exception; + +final class InvalidTrustedHeaderException extends \InvalidArgumentException implements ExceptionInterface +{ + /** + * @var string + */ + private $header; + + /** + * @var string + */ + private $value; + + /** + * @param string $header + * @param string|null $value + * @param string $message + */ + public function __construct($header, $value, $message) + { + parent::__construct($message); + $this->header = $header; + $this->value = $value; + } +} diff --git a/src/Symfony/Component/HttpFoundation/Exception/UntrustedHostException.php b/src/Symfony/Component/HttpFoundation/Exception/UntrustedHostException.php new file mode 100644 index 0000000000000..d3c3479baacf8 --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Exception/UntrustedHostException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Exception; + +/** + * The HTTP request contains host data which is not trusted. + * + * @author SpacePossum + */ +final class UntrustedHostException extends AbstractHostException +{ +} diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 6d629baffd938..79e771f172684 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -12,6 +12,9 @@ namespace Symfony\Component\HttpFoundation; use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException; +use Symfony\Component\HttpFoundation\Exception\InvalidHostException; +use Symfony\Component\HttpFoundation\Exception\InvalidTrustedHeaderException; +use Symfony\Component\HttpFoundation\Exception\UntrustedHostException; use Symfony\Component\HttpFoundation\Session\SessionInterface; /** @@ -602,12 +605,12 @@ public static function getTrustedHosts() * @param string $key The header key * @param string $value The header name * - * @throws \InvalidArgumentException + * @throws InvalidTrustedHeaderException */ public static function setTrustedHeaderName($key, $value) { if (!array_key_exists($key, self::$trustedHeaders)) { - throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key)); + throw new InvalidTrustedHeaderException($key, $value, sprintf('Unable to set the trusted header name for key "%s".', $key)); } self::$trustedHeaders[$key] = $value; @@ -620,12 +623,12 @@ public static function setTrustedHeaderName($key, $value) * * @return string The header name * - * @throws \InvalidArgumentException + * @throws InvalidTrustedHeaderException */ public static function getTrustedHeaderName($key) { if (!array_key_exists($key, self::$trustedHeaders)) { - throw new \InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key)); + throw new InvalidTrustedHeaderException($key, null, sprintf('Unable to get the trusted header name for key "%s".', $key)); } return self::$trustedHeaders[$key]; @@ -788,6 +791,8 @@ public function setSession(SessionInterface $session) * * @return array The client IP addresses * + * @throws ConflictingHeadersException + * * @see getClientIp() */ public function getClientIps() @@ -819,7 +824,7 @@ public function getClientIps() } if ($hasTrustedForwardedHeader && $hasTrustedClientIpHeader && $forwardedClientIps !== $xForwardedForClientIps) { - throw new ConflictingHeadersException('The request has both a trusted Forwarded header and a trusted Client IP header, conflicting with each other with regards to the originating IP addresses of the request. This is the result of a misconfiguration. You should either configure your proxy only to send one of these headers, or configure Symfony to distrust one of them.'); + throw new ConflictingHeadersException('The request has both a trusted Forwarded header and a trusted Client IP header, conflicting with each other with regards to the originating IP addresses of the request. This is the result of a misconfiguration. You should either configure your proxy only to send one of these headers, or configure your project to distrust one of them.'); } if (!$hasTrustedForwardedHeader && !$hasTrustedClientIpHeader) { @@ -1198,7 +1203,8 @@ public function isSecure() * * @return string * - * @throws \UnexpectedValueException when the host name is invalid + * @throws InvalidHostException when the host name is invalid + * @throws UntrustedHostException when the host is not trusted */ public function getHost() { @@ -1220,7 +1226,7 @@ public function getHost() // check that it does not contain forbidden characters (see RFC 952 and RFC 2181) // use preg_replace() instead of preg_match() to prevent DoS attacks with long host names if ($host && '' !== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $host)) { - throw new \UnexpectedValueException(sprintf('Invalid Host "%s"', $host)); + throw new InvalidHostException($host, sprintf('Invalid host "%s".', $host)); } if (count(self::$trustedHostPatterns) > 0) { @@ -1238,7 +1244,7 @@ public function getHost() } } - throw new \UnexpectedValueException(sprintf('Untrusted Host "%s"', $host)); + throw new UntrustedHostException($host, sprintf('Untrusted host "%s".', $host)); } return $host; @@ -1515,7 +1521,7 @@ public function getContent($asResource = false) { $currentContentIsResource = is_resource($this->content); if (PHP_VERSION_ID < 50600 && false === $this->content) { - throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.'); + throw new \LogicException(sprintf('Method %s can only be called once when using the resource return type and PHP below 5.6.', __METHOD__)); } if (true === $asResource) { @@ -1940,7 +1946,12 @@ private static function createRequestFromFactory(array $query = array(), array $ $request = call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content); if (!$request instanceof self) { - throw new \LogicException('The Request factory must return an instance of Symfony\Component\HttpFoundation\Request.'); + throw new \UnexpectedValueException( + sprintf( + 'The Request factory must return an instance of %s. Got %s.', + __CLASS__, is_object($request) ? get_class($request) : (null === $request ? 'null' : gettype($request)) + ) + ); } return $request; diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index d2d2d4e5f23ea..567c3793e0143 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpFoundation\Tests; +use Symfony\Component\HttpFoundation\Exception\UntrustedHostException; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Request; @@ -1872,8 +1873,8 @@ public function testTrustedHosts() try { $request->getHost(); $this->fail('Request::getHost() should throw an exception when host is not trusted.'); - } catch (\UnexpectedValueException $e) { - $this->assertEquals('Untrusted Host "evil.com"', $e->getMessage()); + } catch (UntrustedHostException $e) { + $this->assertEquals('Untrusted host "evil.com".', $e->getMessage()); } // trusted hosts @@ -1936,7 +1937,7 @@ public function testHostValidity($host, $isValid, $expectedHost = null, $expecte $this->assertSame($expectedPort, $request->getPort()); } } else { - $this->setExpectedException('UnexpectedValueException', 'Invalid Host'); + $this->setExpectedException('Symfony\Component\HttpFoundation\Exception\InvalidHostException', 'Invalid host'); $request->getHost(); } } From 45e439f227797540acb51410c4aa7fcf5737915e Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Fri, 4 Nov 2016 10:03:11 +0100 Subject: [PATCH 2/9] Update Request.php --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 79e771f172684..6f0081855716c 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1203,7 +1203,7 @@ public function isSecure() * * @return string * - * @throws InvalidHostException when the host name is invalid + * @throws InvalidHostException when the host name is invalid * @throws UntrustedHostException when the host is not trusted */ public function getHost() From e750da0d7962dc2a22fd4aaedcc1f07d928d687d Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Sat, 5 Nov 2016 10:23:59 +0100 Subject: [PATCH 3/9] process feedbacl --- .../InvalidTrustedHeaderException.php | 37 ------------------- .../Component/HttpFoundation/Request.php | 11 +++--- .../HttpFoundation/Tests/RequestTest.php | 3 +- 3 files changed, 7 insertions(+), 44 deletions(-) delete mode 100644 src/Symfony/Component/HttpFoundation/Exception/InvalidTrustedHeaderException.php diff --git a/src/Symfony/Component/HttpFoundation/Exception/InvalidTrustedHeaderException.php b/src/Symfony/Component/HttpFoundation/Exception/InvalidTrustedHeaderException.php deleted file mode 100644 index 6a0457c8f525f..0000000000000 --- a/src/Symfony/Component/HttpFoundation/Exception/InvalidTrustedHeaderException.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Exception; - -final class InvalidTrustedHeaderException extends \InvalidArgumentException implements ExceptionInterface -{ - /** - * @var string - */ - private $header; - - /** - * @var string - */ - private $value; - - /** - * @param string $header - * @param string|null $value - * @param string $message - */ - public function __construct($header, $value, $message) - { - parent::__construct($message); - $this->header = $header; - $this->value = $value; - } -} diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 6f0081855716c..eab25e4750273 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -13,7 +13,6 @@ use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException; use Symfony\Component\HttpFoundation\Exception\InvalidHostException; -use Symfony\Component\HttpFoundation\Exception\InvalidTrustedHeaderException; use Symfony\Component\HttpFoundation\Exception\UntrustedHostException; use Symfony\Component\HttpFoundation\Session\SessionInterface; @@ -605,12 +604,12 @@ public static function getTrustedHosts() * @param string $key The header key * @param string $value The header name * - * @throws InvalidTrustedHeaderException + * @throws \InvalidArgumentException */ public static function setTrustedHeaderName($key, $value) { if (!array_key_exists($key, self::$trustedHeaders)) { - throw new InvalidTrustedHeaderException($key, $value, sprintf('Unable to set the trusted header name for key "%s".', $key)); + throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key)); } self::$trustedHeaders[$key] = $value; @@ -623,12 +622,12 @@ public static function setTrustedHeaderName($key, $value) * * @return string The header name * - * @throws InvalidTrustedHeaderException + * @throws \InvalidArgumentException */ public static function getTrustedHeaderName($key) { if (!array_key_exists($key, self::$trustedHeaders)) { - throw new InvalidTrustedHeaderException($key, null, sprintf('Unable to get the trusted header name for key "%s".', $key)); + throw new \InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key)); } return self::$trustedHeaders[$key]; @@ -1949,7 +1948,7 @@ private static function createRequestFromFactory(array $query = array(), array $ throw new \UnexpectedValueException( sprintf( 'The Request factory must return an instance of %s. Got %s.', - __CLASS__, is_object($request) ? get_class($request) : (null === $request ? 'null' : gettype($request)) + Request::class, is_object($request) ? get_class($request) : (null === $request ? 'null' : gettype($request)) ) ); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 567c3793e0143..a19b2df159cd7 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpFoundation\Tests; +use Symfony\Component\HttpFoundation\Exception\InvalidHostException; use Symfony\Component\HttpFoundation\Exception\UntrustedHostException; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Session; @@ -1937,7 +1938,7 @@ public function testHostValidity($host, $isValid, $expectedHost = null, $expecte $this->assertSame($expectedPort, $request->getPort()); } } else { - $this->setExpectedException('Symfony\Component\HttpFoundation\Exception\InvalidHostException', 'Invalid host'); + $this->setExpectedException(InvalidHostException::class, 'Invalid host'); $request->getHost(); } } From 9ca7de732c1ba988a883e2207b7957f8d49f23ac Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Sat, 5 Nov 2016 10:39:50 +0100 Subject: [PATCH 4/9] Update Request.php --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index eab25e4750273..27ae7be1a1638 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1948,7 +1948,7 @@ private static function createRequestFromFactory(array $query = array(), array $ throw new \UnexpectedValueException( sprintf( 'The Request factory must return an instance of %s. Got %s.', - Request::class, is_object($request) ? get_class($request) : (null === $request ? 'null' : gettype($request)) + self::class, is_object($request) ? get_class($request) : (null === $request ? 'null' : gettype($request)) ) ); } From b99a3f9369081e42b1889655dfbf4feafc4d468f Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Thu, 10 Nov 2016 10:46:20 +0100 Subject: [PATCH 5/9] Update RequestTest.php --- src/Symfony/Component/HttpFoundation/Tests/RequestTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index a19b2df159cd7..333eb5cb2fa53 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1875,7 +1875,7 @@ public function testTrustedHosts() $request->getHost(); $this->fail('Request::getHost() should throw an exception when host is not trusted.'); } catch (UntrustedHostException $e) { - $this->assertEquals('Untrusted host "evil.com".', $e->getMessage()); + $this->assertEquals('Untrusted Host "evil.com".', $e->getMessage()); } // trusted hosts @@ -1938,7 +1938,7 @@ public function testHostValidity($host, $isValid, $expectedHost = null, $expecte $this->assertSame($expectedPort, $request->getPort()); } } else { - $this->setExpectedException(InvalidHostException::class, 'Invalid host'); + $this->setExpectedException(InvalidHostException::class, 'Invalid Host'); $request->getHost(); } } From 183d59db1bde722ade0c07ff7f62ceaa2885eb4c Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Thu, 10 Nov 2016 10:46:24 +0100 Subject: [PATCH 6/9] Update Request.php --- src/Symfony/Component/HttpFoundation/Request.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 27ae7be1a1638..ba9ba9d2bf130 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1225,7 +1225,7 @@ public function getHost() // check that it does not contain forbidden characters (see RFC 952 and RFC 2181) // use preg_replace() instead of preg_match() to prevent DoS attacks with long host names if ($host && '' !== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $host)) { - throw new InvalidHostException($host, sprintf('Invalid host "%s".', $host)); + throw new InvalidHostException($host, sprintf('Invalid Host "%s".', $host)); } if (count(self::$trustedHostPatterns) > 0) { @@ -1243,7 +1243,7 @@ public function getHost() } } - throw new UntrustedHostException($host, sprintf('Untrusted host "%s".', $host)); + throw new UntrustedHostException($host, sprintf('Untrusted Host "%s".', $host)); } return $host; From c25ff57c27e725d81206ee76f15047f0842604b7 Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Fri, 11 Nov 2016 10:21:23 +0100 Subject: [PATCH 7/9] Update AbstractHostException.php --- .../HttpFoundation/Exception/AbstractHostException.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php b/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php index 1e48e879c9fed..5ee86f4ebbf62 100644 --- a/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php +++ b/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php @@ -12,7 +12,9 @@ namespace Symfony\Component\HttpFoundation\Exception; /** - * THe HTTP request contains incorrect host data. + * The HTTP request contains incorrect host data. + * + * @internal * * @author SpacePossum */ From c721ecc8609b6bc71484d8acd9e0c90c9f5173f9 Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Wed, 16 Nov 2016 12:39:02 +0100 Subject: [PATCH 8/9] Update AbstractHostException.php --- .../HttpFoundation/Exception/AbstractHostException.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php b/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php index 5ee86f4ebbf62..3c1883bf902b0 100644 --- a/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php +++ b/src/Symfony/Component/HttpFoundation/Exception/AbstractHostException.php @@ -20,9 +20,6 @@ */ abstract class AbstractHostException extends \UnexpectedValueException implements ExceptionInterface { - /** - * @var string - */ private $host; /** @@ -35,9 +32,6 @@ public function __construct($host, $message) $this->host = $host; } - /** - * @return string - */ public function getHost() { return $this->host; From 8c9dbb83b2a7d88eff5847c078b0d1c915664b16 Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Fri, 18 Nov 2016 18:50:48 +0100 Subject: [PATCH 9/9] Update Request.php --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index ba9ba9d2bf130..9862371fdb92f 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1945,7 +1945,7 @@ private static function createRequestFromFactory(array $query = array(), array $ $request = call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content); if (!$request instanceof self) { - throw new \UnexpectedValueException( + throw new \LogicException( sprintf( 'The Request factory must return an instance of %s. Got %s.', self::class, is_object($request) ? get_class($request) : (null === $request ? 'null' : gettype($request))