[BUGFIX] Do not throw exception for inaccessible folders 28/50128/2
authorSascha Egerer <sascha@sascha-egerer.de>
Sun, 4 Sep 2016 08:48:13 +0000 (10:48 +0200)
committerJan Helke <typo3@helke.de>
Sat, 8 Oct 2016 14:59:47 +0000 (16:59 +0200)
In the LocalDriver the PHP RecursiveIteratorIterator implementation is
used to recursively iterate over a directory.
If there is a resource child with limited access an exception is thrown
during the initialization of the iterator.
That means you are even not able to iterate over the other folders.

This patch adds a flag that prevents the iterator to throw the exception.

Resolves: #71328
Releases: master, 7.6
Change-Id: I3373f70bbcd5cdb38e5f8998a1e4c0466f6d5260
Reviewed-on: https://review.typo3.org/50128
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php

index 4ca357b..552fb23 100644 (file)
@@ -536,7 +536,8 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver
         if ($recursive) {
             $iterator = new \RecursiveIteratorIterator(
                 new \RecursiveDirectoryIterator($path, $iteratorMode),
-                \RecursiveIteratorIterator::SELF_FIRST
+                \RecursiveIteratorIterator::SELF_FIRST,
+                \RecursiveIteratorIterator::CATCH_GET_CHILD
             );
         } else {
             $iterator = new \RecursiveDirectoryIterator($path, $iteratorMode);
@@ -1054,7 +1055,8 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver
         /** @var $iterator \RecursiveDirectoryIterator */
         $iterator = new \RecursiveIteratorIterator(
             new \RecursiveDirectoryIterator($sourceFolderPath),
-            \RecursiveIteratorIterator::SELF_FIRST
+            \RecursiveIteratorIterator::SELF_FIRST,
+            \RecursiveIteratorIterator::CATCH_GET_CHILD
         );
         // Rewind the iterator as this is important for some systems e.g. Windows
         $iterator->rewind();