[BUGFIX] Do not throw exception for inaccessible folders 52/49852/4
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:11 +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/49852
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Zbigniew Jacko <z.jacko@macopedia.pl>
Tested-by: Zbigniew Jacko <z.jacko@macopedia.pl>
Reviewed-by: Karol Lamparski <klamparski@gmail.com>
Tested-by: Karol Lamparski <klamparski@gmail.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php

index e564b59..16e6b3d 100644 (file)
@@ -522,7 +522,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);
@@ -1045,7 +1046,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();