Handle when SERVER['HTTP_HOST'] is not set
This commit is contained in:
parent
d622ae9251
commit
1a27ac9ab3
|
@ -39,6 +39,7 @@ class Server extends ZM_Object {
|
|||
} else if ( $this->Id() ) {
|
||||
return $this->{'Name'};
|
||||
}
|
||||
if (isset($_SERVER['HTTP_HOST'])) {
|
||||
# This theoretically will match ipv6 addresses as well
|
||||
if ( preg_match( '/^(\[[[:xdigit:]:]+\]|[^:]+)(:[[:digit:]]+)?$/', $_SERVER['HTTP_HOST'], $matches ) ) {
|
||||
return $matches[1];
|
||||
|
@ -47,6 +48,8 @@ class Server extends ZM_Object {
|
|||
$result = explode(':', $_SERVER['HTTP_HOST']);
|
||||
return $result[0];
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function Protocol( $new = null ) {
|
||||
if ( $new != null )
|
||||
|
|
Loading…
Reference in New Issue