diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2021-10-25 17:41:15 +0300 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2021-11-23 11:29:01 +0300 |
commit | 5cd5245ca8b7b37156476ad128131ac5abc3891c (patch) | |
tree | 639f8240332f03dc7fe18ecbf8f6ac88f832bafe /apps/dav/lib/Connector/Sabre | |
parent | 5a20e20e9ea9adbabe73afa5d2096575de5503ea (diff) |
Fix dav application tests and code for PHP 8.1
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Auth.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/FilesReportPlugin.php | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php index a71725af121..6c3600fa5eb 100644 --- a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php @@ -62,7 +62,7 @@ class AnonymousOptionsPlugin extends ServerPlugin { * @return bool */ public function handleAnonymousOptions(RequestInterface $request, ResponseInterface $response) { - $isOffice = preg_match('/Microsoft Office/i', $request->getHeader('User-Agent')); + $isOffice = preg_match('/Microsoft Office/i', $request->getHeader('User-Agent') ?? ''); $emptyAuth = $request->getHeader('Authorization') === null || $request->getHeader('Authorization') === '' || trim($request->getHeader('Authorization')) === 'Bearer'; diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index 30a27f672dd..71e833809ac 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -242,7 +242,7 @@ class Auth extends AbstractBasic { } } - if (!$this->userSession->isLoggedIn() && in_array('XMLHttpRequest', explode(',', $request->getHeader('X-Requested-With')))) { + if (!$this->userSession->isLoggedIn() && in_array('XMLHttpRequest', explode(',', $request->getHeader('X-Requested-With') ?? ''))) { // do not re-authenticate over ajax, use dummy auth name to prevent browser popup $response->addHeader('WWW-Authenticate','DummyBasic realm="' . $this->realm . '"'); $response->setStatus(401); diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index 9524fe59746..4876e9ad8f3 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -241,7 +241,7 @@ class FilesReportPlugin extends ServerPlugin { * * @return string files base uri */ - private function getFilesBaseUri($uri, $subPath) { + private function getFilesBaseUri(string $uri, string $subPath): string { $uri = trim($uri, '/'); $subPath = trim($subPath, '/'); if (empty($subPath)) { |