mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
[BUGFIX] Prevent call getHeader() on null HTTPRequest object
This commit is contained in:
parent
77c85daf56
commit
31c5ab2069
@ -938,12 +938,13 @@ class Director implements TemplateGlobalProvider
|
|||||||
public static function absoluteBaseURLWithAuth(HTTPRequest $request = null)
|
public static function absoluteBaseURLWithAuth(HTTPRequest $request = null)
|
||||||
{
|
{
|
||||||
// Detect basic auth
|
// Detect basic auth
|
||||||
|
$login = '';
|
||||||
|
if ($request) {
|
||||||
$user = $request->getHeader('PHP_AUTH_USER');
|
$user = $request->getHeader('PHP_AUTH_USER');
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$password = $request->getHeader('PHP_AUTH_PW');
|
$password = $request->getHeader('PHP_AUTH_PW');
|
||||||
$login = sprintf("%s:%s@", $user, $password);
|
$login = sprintf("%s:%s@", $user, $password);
|
||||||
} else {
|
}
|
||||||
$login = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Director::protocol($request) . $login . static::host($request) . Director::baseURL();
|
return Director::protocol($request) . $login . static::host($request) . Director::baseURL();
|
||||||
|
Loading…
Reference in New Issue
Block a user