diff options
author | Josh Richards <josh.t.richards@gmail.com> | 2023-06-03 08:57:38 -0400 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-11-12 13:08:18 +0000 |
commit | 0f27494a685fff65c6eb49d15731f7f37de7c1b6 (patch) | |
tree | 4faaad4b0e64e2a48e49923243de119edad54580 | |
parent | ec281fb0af892610b46726eb13ccc55151e3ee48 (diff) | |
download | nextcloud-server-0f27494a685fff65c6eb49d15731f7f37de7c1b6.tar.gz nextcloud-server-0f27494a685fff65c6eb49d15731f7f37de7c1b6.zip |
Clean-up some remaining readdir calls with undesirable false evaluation potential
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
[skip ci]
-rw-r--r-- | apps/files_external/lib/Lib/Storage/Swift.php | 4 | ||||
-rw-r--r-- | apps/files_trashbin/lib/Trashbin.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/Common.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/PolyFill/CopyDirectory.php | 2 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Storage.php | 4 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/EncodingTest.php | 2 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/JailTest.php | 2 |
7 files changed, 9 insertions, 9 deletions
diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index 19c83b29bc8..d3ad11d055c 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -261,7 +261,7 @@ class Swift extends \OC\Files\Storage\Common { } $dh = $this->opendir($path); - while ($file = readdir($dh)) { + while (($file = readdir($dh)) !== false) { if (\OC\Files\Filesystem::isIgnoredDir($file)) { continue; } @@ -527,7 +527,7 @@ class Swift extends \OC\Files\Storage\Common { } $dh = $this->opendir($source); - while ($file = readdir($dh)) { + while (($file = readdir($dh)) !== false) { if (\OC\Files\Filesystem::isIgnoredDir($file)) { continue; } diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index d19ef5cc02b..2fc23c4ef3a 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -1145,7 +1145,7 @@ class Trashbin { public static function isEmpty($user) { $view = new View('/' . $user . '/files_trashbin'); if ($view->is_dir('/files') && $dh = $view->opendir('/files')) { - while ($file = readdir($dh)) { + while (($file = readdir($dh)) !== false) { if (!Filesystem::isIgnoredDir($file)) { return false; } diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 2e6fcd95099..fd447d3fa86 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -230,7 +230,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { $this->remove($target); $dir = $this->opendir($source); $this->mkdir($target); - while ($file = readdir($dir)) { + while (($file = readdir($dir)) !== false) { if (!Filesystem::isIgnoredDir($file)) { if (!$this->copy($source . '/' . $file, $target . '/' . $file)) { closedir($dir); diff --git a/lib/private/Files/Storage/PolyFill/CopyDirectory.php b/lib/private/Files/Storage/PolyFill/CopyDirectory.php index ff05eecb134..c22b9edc592 100644 --- a/lib/private/Files/Storage/PolyFill/CopyDirectory.php +++ b/lib/private/Files/Storage/PolyFill/CopyDirectory.php @@ -86,7 +86,7 @@ trait CopyDirectory { protected function copyRecursive($source, $target) { $dh = $this->opendir($source); $result = true; - while ($file = readdir($dh)) { + while (($file = readdir($dh)) !== false) { if (!\OC\Files\Filesystem::isIgnoredDir($file)) { if ($this->is_dir($source . '/' . $file)) { $this->mkdir($target . '/' . $file); diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php index a646fd5fd0b..6c86c58a272 100644 --- a/tests/lib/Files/Storage/Storage.php +++ b/tests/lib/Files/Storage/Storage.php @@ -81,7 +81,7 @@ abstract class Storage extends \Test\TestCase { $dh = $this->instance->opendir('/'); $content = []; - while ($file = readdir($dh)) { + while (($file = readdir($dh)) !== false) { if ($file != '.' and $file != '..') { $content[] = $file; } @@ -113,7 +113,7 @@ abstract class Storage extends \Test\TestCase { $dh = $this->instance->opendir('/'); $content = []; - while ($file = readdir($dh)) { + while (($file = readdir($dh)) !== false) { if ($file != '.' and $file != '..') { $content[] = $file; } diff --git a/tests/lib/Files/Storage/Wrapper/EncodingTest.php b/tests/lib/Files/Storage/Wrapper/EncodingTest.php index 0901edf83fa..3f14ec64995 100644 --- a/tests/lib/Files/Storage/Wrapper/EncodingTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncodingTest.php @@ -209,7 +209,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { $dh = $this->instance->opendir('/test'); $content = []; - while ($file = readdir($dh)) { + while (($file = readdir($dh)) !== false) { if ($file != '.' and $file != '..') { $content[] = $file; } diff --git a/tests/lib/Files/Storage/Wrapper/JailTest.php b/tests/lib/Files/Storage/Wrapper/JailTest.php index 148bd3a4f30..01fd67ddfb8 100644 --- a/tests/lib/Files/Storage/Wrapper/JailTest.php +++ b/tests/lib/Files/Storage/Wrapper/JailTest.php @@ -28,7 +28,7 @@ class JailTest extends \Test\Files\Storage\Storage { // test that nothing outside our jail is touched $contents = []; $dh = $this->sourceStorage->opendir(''); - while ($file = readdir($dh)) { + while (($file = readdir($dh)) !== false) { if (!\OC\Files\Filesystem::isIgnoredDir($file)) { $contents[] = $file; } |