Skip to content

Commit

Permalink
Merge branch '6.4' into 7.1
Browse files Browse the repository at this point in the history
* 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
  ...
  • Loading branch information
derrabus committed Aug 12, 2024
2 parents 717c632 + cc9d880 commit b7df8a8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Iterator/RecursiveDirectoryIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ public function current(): SplFileInfo
$subPathname .= $this->directorySeparator;
}
$subPathname .= $this->getFilename();
$basePath = $this->rootPath;

if ('/' !== $basePath = $this->rootPath) {
if ('/' !== $basePath && !str_ends_with($basePath, $this->directorySeparator) && !str_ends_with($basePath, '/')) {
$basePath .= $this->directorySeparator;
}

Expand Down
27 changes: 27 additions & 0 deletions Tests/Iterator/RecursiveDirectoryIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,31 @@ public function testSeekOnFtp()

$this->assertEquals($contains, $actual);
}

public function testTrailingDirectorySeparatorIsStripped()
{
$fixturesDirectory = __DIR__ . '/../Fixtures/';
$actual = [];

foreach (new RecursiveDirectoryIterator($fixturesDirectory, RecursiveDirectoryIterator::SKIP_DOTS) as $file) {
$actual[] = $file->getPathname();
}

sort($actual);

$expected = [
$fixturesDirectory.'.dot',
$fixturesDirectory.'A',
$fixturesDirectory.'copy',
$fixturesDirectory.'dolor.txt',
$fixturesDirectory.'gitignore',
$fixturesDirectory.'ipsum.txt',
$fixturesDirectory.'lorem.txt',
$fixturesDirectory.'one',
$fixturesDirectory.'r+e.gex[c]a(r)s',
$fixturesDirectory.'with space',
];

$this->assertEquals($expected, $actual);
}
}

0 comments on commit b7df8a8

Please sign in to comment.