mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #49241 from nextcloud/backport/38630/stable30
[stable30] Fix remaining readdir() calls in loops with undesirable false evaluation potential
This commit is contained in:
commit
56ce5d03bd
8 changed files with 10 additions and 10 deletions
|
|
@ -228,7 +228,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;
|
||||
}
|
||||
|
|
@ -494,7 +494,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1105,7 +1105,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,7 +192,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);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,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);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ function loadDirectory($path): void {
|
|||
return;
|
||||
}
|
||||
|
||||
while ($name = readdir($dh)) {
|
||||
while (($name = readdir($dh)) !== false) {
|
||||
if ($name[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,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;
|
||||
}
|
||||
|
|
@ -99,7 +99,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,7 +208,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue