From 89238164e12ba8532cdefed16a789cbd4e4efde5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 10 May 2017 14:03:14 +0200 Subject: [PATCH] Fix comparisons in the dav app Signed-off-by: Joas Schilling --- apps/dav/lib/CalDAV/CalDavBackend.php | 2 +- apps/dav/lib/CalDAV/Search/SearchPlugin.php | 4 ++-- apps/dav/lib/CardDAV/CardDavBackend.php | 2 +- apps/dav/lib/Connector/Sabre/Directory.php | 2 +- apps/dav/lib/Connector/Sabre/File.php | 4 ++-- apps/dav/lib/Connector/Sabre/ObjectTree.php | 2 +- apps/dav/lib/DAV/Sharing/Backend.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index b85415e28f..d078790b6f 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1158,7 +1158,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $requirePostFilter = false; } // There was a time-range filter - if ($componentType == 'VEVENT' && isset($filters['comp-filters'][0]['time-range'])) { + if ($componentType === 'VEVENT' && isset($filters['comp-filters'][0]['time-range'])) { $timeRange = $filters['comp-filters'][0]['time-range']; // If start time OR the end time is not specified, we can do a diff --git a/apps/dav/lib/CalDAV/Search/SearchPlugin.php b/apps/dav/lib/CalDAV/Search/SearchPlugin.php index d658a50437..84e095da5f 100644 --- a/apps/dav/lib/CalDAV/Search/SearchPlugin.php +++ b/apps/dav/lib/CalDAV/Search/SearchPlugin.php @@ -134,7 +134,7 @@ class SearchPlugin extends ServerPlugin { // If we're dealing with the calendar home, the calendar home itself is // responsible for the calendar-query - if ($node instanceof CalendarHome && $depth == 2) { + if ($node instanceof CalendarHome && $depth === 2) { $nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset); @@ -156,4 +156,4 @@ class SearchPlugin extends ServerPlugin { $this->server->generateMultiStatus($result, $prefer['return'] === 'minimal')); } -} \ No newline at end of file +} diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 9dccffc022..7c27561195 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -1019,7 +1019,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { } $preferred = 0; foreach($property->parameters as $parameter) { - if ($parameter->name == 'TYPE' && strtoupper($parameter->getValue()) == 'PREF') { + if ($parameter->name === 'TYPE' && strtoupper($parameter->getValue()) === 'PREF') { $preferred = 1; break; } diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index 1a97d89646..6fe9d26614 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -225,7 +225,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); } - if ($info['mimetype'] == 'httpd/unix-directory') { + if ($info['mimetype'] === 'httpd/unix-directory') { $node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this->tree, $this->shareManager); } else { $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info, $this->shareManager); diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 63f10034ed..9803beabe3 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -147,7 +147,7 @@ class File extends Node implements IFile { // compare expected and actual size if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { $expected = $_SERVER['CONTENT_LENGTH']; - if ($count != $expected) { + if ($count !== $expected) { throw new BadRequest('expected filesize ' . $expected . ' got ' . $count); } } @@ -410,7 +410,7 @@ class File extends Node implements IFile { if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { if (isset($_SERVER['CONTENT_LENGTH'])) { $expected = $_SERVER['CONTENT_LENGTH']; - if ($bytesWritten != $expected) { + if ($bytesWritten !== $expected) { $chunk_handler->remove($info['index']); throw new BadRequest( 'expected filesize ' . $expected . ' got ' . $bytesWritten); diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index d298d6be84..3371c655f2 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -81,7 +81,7 @@ class ObjectTree extends \Sabre\DAV\Tree { if (isset($_SERVER['HTTP_OC_CHUNKED'])) { // resolve to real file name to find the proper node list($dir, $name) = \Sabre\Uri\split($path); - if ($dir == '/' || $dir == '.') { + if ($dir === '/' || $dir === '.') { $dir = ''; } diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index f662d8e1b8..6cc5e3b6f5 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -170,7 +170,7 @@ class Backend { 'href' => "principal:${row['principaluri']}", 'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '', 'status' => 1, - 'readOnly' => ($row['access'] == self::ACCESS_READ), + 'readOnly' => ((int) $row['access'] === self::ACCESS_READ), '{http://owncloud.org/ns}principal' => $row['principaluri'], '{http://owncloud.org/ns}group-share' => is_null($p) ];