diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2013-09-04 13:06:04 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2013-09-04 13:06:04 +0200 |
commit | ec3639dc7a28348b136d2008e692cffe8c3753ad (patch) | |
tree | 3d197d325496925be0ddee1f1ab22c48c7c817a1 /lib/files/view.php | |
parent | 09187f3b3b30e6f810c6afff7332615ed472154e (diff) | |
download | nextcloud-server-ec3639dc7a28348b136d2008e692cffe8c3753ad.tar.gz nextcloud-server-ec3639dc7a28348b136d2008e692cffe8c3753ad.zip |
Always check variable type before using readdir to avoid surprises
Diffstat (limited to 'lib/files/view.php')
-rw-r--r-- | lib/files/view.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/files/view.php b/lib/files/view.php index 8aee12bf6fe..14de92c2005 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -500,9 +500,11 @@ class View { } else { if ($this->is_dir($path1) && ($dh = $this->opendir($path1))) { $result = $this->mkdir($path2); - while (($file = readdir($dh)) !== false) { - if (!Filesystem::isIgnoredDir($file)) { - $result = $this->copy($path1 . '/' . $file, $path2 . '/' . $file); + if(is_resource($dh)) { + while (($file = readdir($dh)) !== false) { + if (!Filesystem::isIgnoredDir($file)) { + $result = $this->copy($path1 . '/' . $file, $path2 . '/' . $file); + } } } } else { |