mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Don't try to use HTTP_HOST environment variable if its not set in Director::protocolAndHost(). Throw a warning, then return false - before if script execution was not set to stop on WARNING, you'll get a NOTICE as well.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63291 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
21944a2e06
commit
6afad36c39
@ -284,6 +284,8 @@ class Director {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the part of the URL, 'http://www.mysite.com'.
|
* Returns the part of the URL, 'http://www.mysite.com'.
|
||||||
|
*
|
||||||
|
* @return boolean|string The domain from the PHP enviroment. Returns FALSE is this environment variable isn't set.
|
||||||
*/
|
*/
|
||||||
static function protocolAndHost() {
|
static function protocolAndHost() {
|
||||||
if(self::$alternateBaseURL) {
|
if(self::$alternateBaseURL) {
|
||||||
@ -294,11 +296,13 @@ class Director {
|
|||||||
|
|
||||||
$s = (isset($_SERVER['SSL']) || isset($_SERVER['HTTPS'])) ? 's' : '';
|
$s = (isset($_SERVER['SSL']) || isset($_SERVER['HTTPS'])) ? 's' : '';
|
||||||
|
|
||||||
if(!isset($_SERVER['HTTP_HOST'])) {
|
if(isset($_SERVER['HTTP_HOST'])) {
|
||||||
user_error("Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set.", E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
return "http$s://" . $_SERVER['HTTP_HOST'];
|
return "http$s://" . $_SERVER['HTTP_HOST'];
|
||||||
|
} else {
|
||||||
|
user_error("Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set.", E_USER_WARNING);
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user