From d8be9d96edec4ef8934b46e32298dfbed2b2a0a3 Mon Sep 17 00:00:00 2001
From: Sjors van der Pluijm <sjors@youngguns.nl>
Date: Mon, 28 Apr 2014 10:20:24 +0200
Subject: [PATCH] fixes #8376

---
 lib/private/files/storage/local.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index ff2949d33b..16689ee905 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -44,17 +44,20 @@ if (\OC_Util::runningOnWindows()) {
 					new \RecursiveDirectoryIterator($this->datadir . $path),
 					\RecursiveIteratorIterator::CHILD_FIRST
 				);
-				foreach ($it as $file) {
+				while ($it->valid()) {
 					/**
 					 * @var \SplFileInfo $file
 					 */
+					$file = $it->current();
 					if (in_array($file->getBasename(), array('.', '..'))) {
+						$it->next();
 						continue;
 					} elseif ($file->isDir()) {
 						rmdir($file->getPathname());
 					} elseif ($file->isFile() || $file->isLink()) {
 						unlink($file->getPathname());
 					}
+					$it->next();
 				}
 				return rmdir($this->datadir . $path);
 			} catch (\UnexpectedValueException $e) {
-- 
GitLab