From 8678f22f6bf94e0a5c862f864e5a3d06cc31dd07 Mon Sep 17 00:00:00 2001 From: Keith Bentrup Date: Wed, 23 Oct 2019 17:39:05 -0400 Subject: [PATCH] do NOT ignore "." dirs OR ignore "." dirs and all children (#2581) If you ignore any "files" beginning with "." including directories, then the all() method will exclude .somedir, but not .somedir/somefile. Subsequently, when trying to copy all files returned from all(), it will fail when the method tries to copy a file into a directory that has not yet been created because .somedir was omitted from the return array of all(). I found this bug when trying to install the admin plugin and ./tmp was a mount and thus rename() failed and self:copy() was invoked instead (line 365). --- system/src/Grav/Common/Filesystem/Folder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Filesystem/Folder.php b/system/src/Grav/Common/Filesystem/Folder.php index f17410c49..2a38d88e5 100644 --- a/system/src/Grav/Common/Filesystem/Folder.php +++ b/system/src/Grav/Common/Filesystem/Folder.php @@ -235,7 +235,7 @@ abstract class Folder /** @var \RecursiveDirectoryIterator $file */ foreach ($iterator as $file) { // Ignore hidden files. - if (strpos($file->getFilename(), '.') === 0) { + if (strpos($file->getFilename(), '.') === 0 && $file->isFile()) { continue; } if (!$folders && $file->isDir()) {