BUG Fix BASE_URL on CLI

Fixes #7256
This commit is contained in:
Damian Mooyman 2017-08-23 14:48:28 +12:00
parent 2c34af72e1
commit 1b087221d2
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
1 changed files with 2 additions and 2 deletions

View File

@ -82,8 +82,8 @@ if (!defined('BASE_URL')) {
$urlSegmentToRemove = substr($path, strlen(BASE_PATH));
if (substr($_SERVER['SCRIPT_NAME'], -strlen($urlSegmentToRemove)) == $urlSegmentToRemove) {
$baseURL = substr($_SERVER['SCRIPT_NAME'], 0, -strlen($urlSegmentToRemove));
// Normalise slashes to '/' and rtrim('/')
return rtrim(str_replace('\\', '/', $baseURL), '/');
// ltrim('.'), normalise slashes to '/', and rtrim('/')
return rtrim(str_replace('\\', '/', ltrim($baseURL, '.')), '/');
}
}