[core] attempt to figure out base href from SCRIPT_FILENAME + DOCUMENT_ROOT, see #1024

This commit is contained in:
Shish 2024-02-07 18:28:31 +00:00
parent db902d6d26
commit e9c8e852a5

View file

@ -314,6 +314,9 @@ function get_base_href(): string
break;
}
}
if(empty($ok_var) && isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['DOCUMENT_ROOT'])) {
$ok_var = substr($_SERVER['SCRIPT_FILENAME'], strlen($_SERVER['DOCUMENT_ROOT']));
}
assert(!empty($ok_var));
$dir = dirname($ok_var);
$dir = str_replace("\\", "/", $dir);