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

Skip to content
Prev Previous commit
Next Next commit
Fixed compatibility with PHP 5.3
  • Loading branch information
ausi committed Apr 7, 2017
commit 28b29ee4aee3969561d27df033c82d99f7c77309
7 changes: 3 additions & 4 deletions src/Symfony/Component/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,7 @@ public function makePathRelative($endPath, $startPath)
$startPathArr = explode('/', trim($startPath, '/'));
$endPathArr = explode('/', trim($endPath, '/'));

$normalizePathArray = function ($pathSegments, $path) {
$absolute = Filesystem::isAbsolutePath($path);
$normalizePathArray = function ($pathSegments, $absolute) {
$result = array();

foreach ($pathSegments as $segment) {
Expand All @@ -388,8 +387,8 @@ public function makePathRelative($endPath, $startPath)
return $result;
};

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

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