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
-------
9e431038b2
fix unix root dir issue
This commit is contained in:
commit
f6f6a600a8
@ -744,6 +744,10 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*/
|
||||
private function normalizeDir($dir)
|
||||
{
|
||||
if ('/' === $dir) {
|
||||
return $dir;
|
||||
}
|
||||
|
||||
$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
|
||||
|
||||
if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {
|
||||
|
@ -74,7 +74,11 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
||||
}
|
||||
$subPathname .= $this->getFilename();
|
||||
|
||||
return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
|
||||
if ('/' !== $basePath = $this->rootPath) {
|
||||
$basePath .= $this->directorySeparator;
|
||||
}
|
||||
|
||||
return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user