Skip to content

Commit b7df8a8

Browse files
committed
Merge branch '6.4' into 7.1
* 6.4: (23 commits) fix tests using Twig 3.12 skip tests requiring the intl extension if it's not installed 🐛 throw ParseException on invalid date fix permitted data type of the default choice [ExpressionLanguage] Improve test coverage Fix invalid phpdoc in ContainerBuilder [HttpKernel] [WebProfileBundle] Fix Routing panel for URLs with a colon [Form] NumberType: Fix parsing of numbers in exponential notation with negative exponent [Security] consistent singular/plural translation in Dutch reset the validation context after validating nested constraints do not duplicate directory separators fix handling empty data in ValueToDuplicatesTransformer fix compatibility with redis extension 6.0.3+ synchronize unsupported scheme tests [String] Fixed Quorum plural, that was inflected to be only "Quora" and never "Quorums" Fix symfony/kaz-info-teh-notifier package [Validator] review latvian translations [Validator] Add Dutch translation for `WordCount` constraint allow more unicode characters in URL paths [String][EnglishInflector] Fix words ending in 'le', e.g., articles ...
2 parents 717c632 + cc9d880 commit b7df8a8

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

Iterator/RecursiveDirectoryIterator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ public function current(): SplFileInfo
6363
$subPathname .= $this->directorySeparator;
6464
}
6565
$subPathname .= $this->getFilename();
66+
$basePath = $this->rootPath;
6667

67-
if ('/' !== $basePath = $this->rootPath) {
68+
if ('/' !== $basePath && !str_ends_with($basePath, $this->directorySeparator) && !str_ends_with($basePath, '/')) {
6869
$basePath .= $this->directorySeparator;
6970
}
7071

Tests/Iterator/RecursiveDirectoryIteratorTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,31 @@ public function testSeekOnFtp()
5555

5656
$this->assertEquals($contains, $actual);
5757
}
58+
59+
public function testTrailingDirectorySeparatorIsStripped()
60+
{
61+
$fixturesDirectory = __DIR__ . '/../Fixtures/';
62+
$actual = [];
63+
64+
foreach (new RecursiveDirectoryIterator($fixturesDirectory, RecursiveDirectoryIterator::SKIP_DOTS) as $file) {
65+
$actual[] = $file->getPathname();
66+
}
67+
68+
sort($actual);
69+
70+
$expected = [
71+
$fixturesDirectory.'.dot',
72+
$fixturesDirectory.'A',
73+
$fixturesDirectory.'copy',
74+
$fixturesDirectory.'dolor.txt',
75+
$fixturesDirectory.'gitignore',
76+
$fixturesDirectory.'ipsum.txt',
77+
$fixturesDirectory.'lorem.txt',
78+
$fixturesDirectory.'one',
79+
$fixturesDirectory.'r+e.gex[c]a(r)s',
80+
$fixturesDirectory.'with space',
81+
];
82+
83+
$this->assertEquals($expected, $actual);
84+
}
5885
}

0 commit comments

Comments
 (0)