bug #15282 [HttpFoundation] Behaviour change in PHP7 for substr (Nicofuma)

This PR was merged into the 2.3 branch.

Discussion
----------

[HttpFoundation] Behaviour change in PHP7 for substr

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

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

Commits
-------

ba6000b [HttpFoundation] Behaviour change in PHP7 for substr
This commit is contained in:
Fabien Potencier 2015-07-16 01:29:21 +02:00
commit d6af4ad7bf
1 changed files with 2 additions and 1 deletions

View File

@ -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) {