aboutsummaryrefslogtreecommitdiffstats
path: root/lib/connector/sabre
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-09-04 13:06:04 +0200
committerArthur Schiwon <blizzz@owncloud.com>2013-09-04 13:06:04 +0200
commitec3639dc7a28348b136d2008e692cffe8c3753ad (patch)
tree3d197d325496925be0ddee1f1ab22c48c7c817a1 /lib/connector/sabre
parent09187f3b3b30e6f810c6afff7332615ed472154e (diff)
downloadnextcloud-server-ec3639dc7a28348b136d2008e692cffe8c3753ad.tar.gz
nextcloud-server-ec3639dc7a28348b136d2008e692cffe8c3753ad.zip
Always check variable type before using readdir to avoid surprises
Diffstat (limited to 'lib/connector/sabre')
-rw-r--r--lib/connector/sabre/objecttree.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/connector/sabre/objecttree.php b/lib/connector/sabre/objecttree.php
index b298813a202..acff45ed5e2 100644
--- a/lib/connector/sabre/objecttree.php
+++ b/lib/connector/sabre/objecttree.php
@@ -88,11 +88,13 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
} else {
Filesystem::mkdir($destination);
$dh = Filesystem::opendir($source);
- while (($subnode = readdir($dh)) !== false) {
+ if(is_resource($dh)) {
+ while (($subnode = readdir($dh)) !== false) {
- if ($subnode == '.' || $subnode == '..') continue;
- $this->copy($source . '/' . $subnode, $destination . '/' . $subnode);
+ if ($subnode == '.' || $subnode == '..') continue;
+ $this->copy($source . '/' . $subnode, $destination . '/' . $subnode);
+ }
}
}