BUGFIX: Fixed issue on windows where the BASE_URL constant would get set wrong if the site was in a sub-folder of the web root

This commit is contained in:
UndefinedOffset 2017-10-12 10:54:27 -03:00
parent 3824655df4
commit 7ff707df73
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,7 @@ if (!defined('BASE_URL')) {
// This tends not to work on CLI
$path = realpath($_SERVER['SCRIPT_FILENAME']);
if (substr($path, 0, strlen(BASE_PATH)) == BASE_PATH) {
$urlSegmentToRemove = substr($path, strlen(BASE_PATH));
$urlSegmentToRemove = str_replace('\\', '/', substr($path, strlen(BASE_PATH)));
if (substr($_SERVER['SCRIPT_NAME'], -strlen($urlSegmentToRemove)) == $urlSegmentToRemove) {
$baseURL = substr($_SERVER['SCRIPT_NAME'], 0, -strlen($urlSegmentToRemove));
// ltrim('.'), normalise slashes to '/', and rtrim('/')