Url: Fix automatic stripping of the current base url in method fromPath()

This commit is contained in:
Johannes Meyer 2015-09-30 15:36:45 +02:00
parent 415690134b
commit eef4322188
1 changed files with 4 additions and 5 deletions

View File

@ -161,16 +161,15 @@ class Url
if ($urlPath && $urlPath[0] === '/') {
if ($baseUrl) {
$urlPath = substr($urlPath, 1);
} elseif (strpos($urlPath, $request->getBaseUrl()) === 0) {
$baseUrl = $request->getBaseUrl();
$urlPath = substr($urlPath, strlen($baseUrl) + 1);
}
} elseif (! $baseUrl) {
$baseUrl = $request->getBaseUrl();
}
if ($baseUrl && !$urlObject->isExternal() && strpos($urlPath, $baseUrl) === 0) {
$urlObject->setPath(substr($urlPath, strlen($baseUrl)));
} else {
$urlObject->setPath($urlPath);
}
} elseif (! $baseUrl) {
$baseUrl = $request->getBaseUrl();
}