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

Skip to content

Commit 15982d4

Browse files
committed
Normalize ./ path segments
1 parent 3a29c1d commit 15982d4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ public function makePathRelative($endPath, $startPath)
378378
foreach ($pathSegments as $segment) {
379379
if ('..' === $segment) {
380380
array_pop($result);
381-
} else {
381+
} elseif ('.' !== $segment) {
382382
$result[] = $segment;
383383
}
384384
}

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,9 @@ public function providePathsForMakePathRelative()
881881
array('C:/../../aa/../bb/cc', 'C:/aa/dd/..', '../bb/cc/'),
882882
array('aa/bb', 'aa/cc', '../bb/'),
883883
array('aa/cc', 'bb/cc', '../../aa/cc/'),
884+
array('aa/bb', 'aa/./cc', '../bb/'),
885+
array('aa/./bb', 'aa/cc', '../bb/'),
886+
array('aa/./bb', 'aa/./cc', '../bb/'),
884887
);
885888

886889
if ('\\' === DIRECTORY_SEPARATOR) {

0 commit comments

Comments
 (0)