summaryrefslogtreecommitdiffstats
path: root/lib/files
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-08-19 12:04:53 +0200
committerRobin Appelman <icewind@owncloud.com>2013-08-19 12:04:53 +0200
commitc5402f457530577999d1adc1715c76e742ad8aa9 (patch)
tree85b40240d914a51513940c14179fdecdcb78ad4c /lib/files
parenta1d5aba5fd3795a6ee4a87c96abf0d35d3f8116d (diff)
downloadnextcloud-server-c5402f457530577999d1adc1715c76e742ad8aa9.tar.gz
nextcloud-server-c5402f457530577999d1adc1715c76e742ad8aa9.zip
use strict equals in readdir loops to prevent issues with '0' files
Diffstat (limited to 'lib/files')
-rw-r--r--lib/files/cache/scanner.php2
-rw-r--r--lib/files/storage/common.php6
-rw-r--r--lib/files/view.php2
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php
index 597eabecf54..87fa7c1365a 100644
--- a/lib/files/cache/scanner.php
+++ b/lib/files/cache/scanner.php
@@ -159,7 +159,7 @@ class Scanner extends BasicEmitter {
$newChildren = array();
if ($this->storage->is_dir($path) && ($dh = $this->storage->opendir($path))) {
\OC_DB::beginTransaction();
- while ($file = readdir($dh)) {
+ while (($file = readdir($dh)) !== false) {
$child = ($path) ? $path . '/' . $file : $file;
if (!Filesystem::isIgnoredDir($file)) {
$newChildren[] = $file;
diff --git a/lib/files/storage/common.php b/lib/files/storage/common.php
index 3da13ac4df0..1a273240eeb 100644
--- a/lib/files/storage/common.php
+++ b/lib/files/storage/common.php
@@ -142,7 +142,7 @@ abstract class Common implements \OC\Files\Storage\Storage {
return false;
} else {
$directoryHandle = $this->opendir($directory);
- while ($contents = readdir($directoryHandle)) {
+ while (($contents = readdir($directoryHandle)) !== false) {
if (!\OC\Files\Filesystem::isIgnoredDir($contents)) {
$path = $directory . '/' . $contents;
if ($this->is_dir($path)) {
@@ -225,7 +225,7 @@ abstract class Common implements \OC\Files\Storage\Storage {
private function addLocalFolder($path, $target) {
if ($dh = $this->opendir($path)) {
- while ($file = readdir($dh)) {
+ while (($file = readdir($dh)) !== false) {
if ($file !== '.' and $file !== '..') {
if ($this->is_dir($path . '/' . $file)) {
mkdir($target . '/' . $file);
@@ -243,7 +243,7 @@ abstract class Common implements \OC\Files\Storage\Storage {
$files = array();
$dh = $this->opendir($dir);
if ($dh) {
- while ($item = readdir($dh)) {
+ while (($item = readdir($dh)) !== false) {
if ($item == '.' || $item == '..') continue;
if (strstr(strtolower($item), strtolower($query)) !== false) {
$files[] = $dir . '/' . $item;
diff --git a/lib/files/view.php b/lib/files/view.php
index c9727fe4984..bb737f19ef8 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -499,7 +499,7 @@ class View {
} else {
if ($this->is_dir($path1) && ($dh = $this->opendir($path1))) {
$result = $this->mkdir($path2);
- while ($file = readdir($dh)) {
+ while (($file = readdir($dh)) !== false) {
if (!Filesystem::isIgnoredDir($file)) {
$result = $this->copy($path1 . '/' . $file, $path2 . '/' . $file);
}