summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-17 11:42:31 +0100
committerGitHub <noreply@github.com>2018-01-17 11:42:31 +0100
commitc121610d5a42b8a30a328c0a2f9704fb20d4c369 (patch)
treefab73c631b184cb30229ece3995d536c9dce8707 /lib
parent9222dcd9401717cf9335af5f5bc0ef3bf8f0b713 (diff)
parent4ef302c0be2047f78b1aa3976eba003a2c280f64 (diff)
downloadnextcloud-server-c121610d5a42b8a30a328c0a2f9704fb20d4c369.tar.gz
nextcloud-server-c121610d5a42b8a30a328c0a2f9704fb20d4c369.zip
Merge pull request #7813 from nextcloud/getHeader-should-only-return-string
Request->getHeader() should always return a string
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/Http/Request.php5
-rw-r--r--lib/private/L10N/Factory.php2
-rw-r--r--lib/private/Log/File.php5
-rw-r--r--lib/private/Memcache/APCu.php4
4 files changed, 9 insertions, 7 deletions
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php
index 77ecb02165b..975c4255d5a 100644
--- a/lib/private/AppFramework/Http/Request.php
+++ b/lib/private/AppFramework/Http/Request.php
@@ -324,7 +324,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
- return null;
+ return '';
}
/**
@@ -404,8 +404,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
protected function getContent() {
// If the content can't be parsed into an array then return a stream resource.
if ($this->method === 'PUT'
- && $this->getHeader('Content-Length') !== 0
- && $this->getHeader('Content-Length') !== null
+ && $this->getHeader('Content-Length') !== '0'
&& $this->getHeader('Content-Length') !== ''
&& strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false
&& strpos($this->getHeader('Content-Type'), 'application/json') === false
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php
index e277a00e653..8268be05d4b 100644
--- a/lib/private/L10N/Factory.php
+++ b/lib/private/L10N/Factory.php
@@ -247,7 +247,7 @@ class Factory implements IFactory {
*/
private function getLanguageFromRequest($app) {
$header = $this->request->getHeader('ACCEPT_LANGUAGE');
- if ($header) {
+ if ($header !== '') {
$available = $this->findAvailableLanguages($app);
// E.g. make sure that 'de' is before 'de_DE'.
diff --git a/lib/private/Log/File.php b/lib/private/Log/File.php
index b6a208ad68a..290f7897c9d 100644
--- a/lib/private/Log/File.php
+++ b/lib/private/Log/File.php
@@ -105,7 +105,10 @@ class File {
} else {
$user = '--';
}
- $userAgent = $request->getHeader('User-Agent') ?: '--';
+ $userAgent = $request->getHeader('User-Agent');
+ if ($userAgent === '') {
+ $userAgent = '--';
+ }
$version = $config->getValue('version', '');
$entry = compact(
'reqId',
diff --git a/lib/private/Memcache/APCu.php b/lib/private/Memcache/APCu.php
index 70f0d73d2d4..3e96acdecb7 100644
--- a/lib/private/Memcache/APCu.php
+++ b/lib/private/Memcache/APCu.php
@@ -158,8 +158,8 @@ class APCu extends Cache implements IMemcache {
} elseif (!\OC::$server->getIniWrapper()->getBool('apc.enable_cli') && \OC::$CLI) {
return false;
} elseif (
- version_compare(phpversion('apc'), '4.0.6') === -1 &&
- version_compare(phpversion('apcu'), '5.1.0') === -1
+ version_compare(phpversion('apc') ?: '0.0.0', '4.0.6') === -1 &&
+ version_compare(phpversion('apcu') ?: '0.0.0', '5.1.0') === -1
) {
return false;
} else {