From ba6000baff99addb29890b134fabb4792be506dd Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 15 Jul 2015 10:22:14 +0200 Subject: [PATCH] [HttpFoundation] Behaviour change in PHP7 for substr In PHP7 the behaviour of substr() changed. To resume: "Truncating an entire string should result in a string." See: https://bugs.php.net/bug.php?id=62922 --- src/Symfony/Component/HttpFoundation/Request.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 84b3a69ade..3b31d8e593 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1790,7 +1790,8 @@ class Request $requestUri = substr($requestUri, 0, $pos); } - if (null !== $baseUrl && false === $pathInfo = substr($requestUri, strlen($baseUrl))) { + $pathInfo = substr($requestUri, strlen($baseUrl)); + if (null !== $baseUrl && (false === $pathInfo || '' === $pathInfo)) { // If substr() returns false then PATH_INFO is set to an empty string return '/'; } elseif (null === $baseUrl) {