8000 bug #35693 [Finder] Fix unix root dir issue (chr-hertel) · symfony/symfony@f6f6a60 · GitHub
[go: up one dir, main page]

Skip to content

Commit f6f6a60

Browse files
committed
bug #35693 [Finder] Fix unix root dir issue (chr-hertel)
This PR was submitted for the 4.4 branch but it was merged into the 3.4 branch instead. Discussion ---------- [Finder] Fix unix root dir issue | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #35683 | License | MIT not quite sure about this one 🤔 Commits ------- 9e43103 fix unix root dir issue
2 parents f20b36e + 9e43103 commit f6f6a60

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Symfony/Component/Finder/Finder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,10 @@ private function searchInDirectory($dir)
744744
*/
745745
private function normalizeDir($dir)
746746
{
747+
if ('/' === $dir) {
748+
return $dir;
749+
}
750+
747751
$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
748752

749753
if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ public function current()
7474
}
7575
$subPathname .= $this->getFilename();
7676

77-
return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
77+
if ('/' !== $basePath = $this->rootPath) {
78+
$basePath .= $this->directorySeparator;
79+
}
80+
81+
return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
7882
}
7983

8084
/**

0 commit comments

Comments
 (0)
0