Skip to content

Commit ba6000b

Browse files
author
Tristan Darricau
committed
[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
1 parent 9962f36 commit ba6000b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,8 @@ protected function preparePathInfo()
17901790
$requestUri = substr($requestUri, 0, $pos);
17911791
}
17921792

1793-
if (null !== $baseUrl && false === $pathInfo = substr($requestUri, strlen($baseUrl))) {
1793+
$pathInfo = substr($requestUri, strlen($baseUrl));
1794+
if (null !== $baseUrl && (false === $pathInfo || '' === $pathInfo)) {
17941795
// If substr() returns false then PATH_INFO is set to an empty string
17951796
return '/';
17961797
} elseif (null === $baseUrl) {

0 commit comments

Comments
 (0)