From 8b1e16c4dfc7c5e5eb0c557b86831adc0664778f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 30 Mar 2022 11:19:30 +0200 Subject: Fix incorrect if conditions in View MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ($something->getPermissions() && Constants::PERMISSION_READ) does not make sense as PERMISSION_READ contant is 1 this will always evaluate to true. getPersmissions is returning an int which is a bitwise combination as documented in the interface, so it should be used with bit operators. Signed-off-by: Côme Chilliet --- lib/private/Files/View.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 4e3966b711c..141918918e6 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1179,7 +1179,7 @@ class View { throw $e; } - if ($result && in_array('delete', $hooks) and $result) { + if ($result && in_array('delete', $hooks)) { $this->removeUpdate($storage, $internalPath); } if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { @@ -1453,7 +1453,7 @@ class View { $data = $this->getCacheEntry($storage, $internalPath, $directory); - if (!$data instanceof ICacheEntry || !isset($data['fileid']) || !($data->getPermissions() && Constants::PERMISSION_READ)) { + if (!$data instanceof ICacheEntry || !isset($data['fileid']) || !($data->getPermissions() & Constants::PERMISSION_READ)) { return []; } @@ -1507,7 +1507,7 @@ class View { $rootEntry = $subCache->get(''); } - if ($rootEntry && ($rootEntry->getPermissions() && Constants::PERMISSION_READ)) { + if ($rootEntry && ($rootEntry->getPermissions() & Constants::PERMISSION_READ)) { $relativePath = trim(substr($mountPoint, $dirLength), '/'); if ($pos = strpos($relativePath, '/')) { //mountpoint inside subfolder add size to the correct folder -- cgit v1.2.3