Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 15ccef7

Browse files
committed
bug #18065 [Finder] Partially revert #17134 to fix a regression (jakzal)
This PR was merged into the 2.3 branch. Discussion ---------- [Finder] Partially revert #17134 to fix a regression | Q | A | ------------- | --- | Branch | 2.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18013 | License | MIT | Doc PR | - Commits ------- ead1824 [Finder] Partially revert #17134 to fix a regression
2 parents 5d8067f + ead1824 commit 15ccef7

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)