File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,18 @@ public function rewind()
3939 while ($ iterator instanceof \OuterIterator) {
4040 $ innerIterator = $ iterator ->getInnerIterator ();
4141
42- if ($ innerIterator instanceof \FilesystemIterator) {
42+ if ($ innerIterator instanceof RecursiveDirectoryIterator) {
43+ // this condition is necessary for iterators to work properly with non-local filesystems like ftp
44+ if ($ innerIterator ->isRewindable ()) {
45+ $ innerIterator ->next ();
46+ $ innerIterator ->rewind ();
47+ }
48+ } elseif ($ innerIterator instanceof \FilesystemIterator) {
4349 $ innerIterator ->next ();
4450 $ innerIterator ->rewind ();
4551 }
46- $ iterator = $ iterator ->getInnerIterator ();
52+
53+ $ iterator = $ innerIterator ;
4754 }
4855
4956 parent ::rewind ();
You can’t perform that action at this time.
0 commit comments