summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-06-22 12:28:07 +0200
committerLukas Reschke <lukas@owncloud.com>2015-06-22 12:28:07 +0200
commit4d23e060971d195da0c23cb00da297e581b6cffd (patch)
treee5ee9a9856647c6b1d158780e84cf0a48dbde4c9 /lib
parentc77e44117d1cdb45a224e3f370acbb09f1b095dc (diff)
downloadnextcloud-server-4d23e060971d195da0c23cb00da297e581b6cffd.tar.gz
nextcloud-server-4d23e060971d195da0c23cb00da297e581b6cffd.zip
Fix undefined offset
There are cases where no trusted host is specified such as when installing the instance, this lead to an undefined offset warning in the log right after installing. (when another domain than localhost or 127.0.0.1 was used)
Diffstat (limited to 'lib')
-rw-r--r--lib/private/appframework/http/request.php11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index 2455209cdf3..f72ad7cc1d8 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -658,11 +658,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @return string Server host
*/
public function getServerHost() {
- // FIXME: Ugly workaround that we need to get rid of
- if (\OC::$CLI && defined('PHPUNIT_RUN')) {
- return 'localhost';
- }
-
// overwritehost is always trusted
$host = $this->getOverwriteHost();
if ($host !== null) {
@@ -680,7 +675,11 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return $host;
} else {
$trustedList = $this->config->getSystemValue('trusted_domains', []);
- return $trustedList[0];
+ if(!empty($trustedList)) {
+ return $trustedList[0];
+ } else {
+ return '';
+ }
}
}