8000 [Finder] Partially revert #17134 to fix a regression · symfony/symfony@ead1824 · GitHub
[go: up one dir, main page]

Skip to content

Commit ead1824

Browse files
committed
[Finder] Partially revert #17134 to fix a regression
1 parent 35666f0 commit ead1824

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Symfony/Component/Finder/Iterator/FilterIterator.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)
0