Skip to content

Commit

Permalink
removed checks for absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Bakai committed Nov 18, 2017
1 parent 8eb97f5 commit 9da7c50
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Symfony/Component/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,11 @@ public function makePathRelative($endPath, $startPath)
$startPathArr = explode('/', trim($startPath, '/'));
$endPathArr = explode('/', trim($endPath, '/'));

$normalizePathArray = function ($pathSegments, $absolute) {
$normalizePathArray = function ($pathSegments) {
$result = array();

foreach ($pathSegments as $segment) {
if ('..' === $segment && ($absolute || count($result))) {
if ('..' === $segment) {
array_pop($result);
} elseif ('.' !== $segment) {
$result[] = $segment;
Expand All @@ -494,8 +494,8 @@ public function makePathRelative($endPath, $startPath)
return $result;
};

$startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
$endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
$startPathArr = $normalizePathArray($startPathArr);
$endPathArr = $normalizePathArray($endPathArr);

// Find for which directory the common path stops
$index = 0;
Expand Down

0 comments on commit 9da7c50

Please sign in to comment.