diff --git a/src/Composer/Downloader/Util/Filesystem.php b/src/Composer/Downloader/Util/Filesystem.php index e486d8631..13f0877d2 100644 --- a/src/Composer/Downloader/Util/Filesystem.php +++ b/src/Composer/Downloader/Util/Filesystem.php @@ -58,8 +58,8 @@ class Filesystem if (dirname($from) === dirname($to)) { return './'.basename($to); } - $from = rtrim(strtr($from, '\\', '/'), '/'); - $to = rtrim(strtr($to, '\\', '/'), '/'); + $from = lcfirst(rtrim(strtr($from, '\\', '/'), '/')); + $to = lcfirst(rtrim(strtr($to, '\\', '/'), '/')); $commonPath = $to; while (strpos($from, $commonPath) !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) { @@ -93,8 +93,8 @@ class Filesystem if ($from === $to) { return $directories ? '__DIR__' : '__FILE__'; } - $from = strtr($from, '\\', '/'); - $to = strtr($to, '\\', '/'); + $from = lcfirst(strtr($from, '\\', '/')); + $to = lcfirst(strtr($to, '\\', '/')); $commonPath = $to; while (strpos($from, $commonPath) !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) { diff --git a/tests/Composer/Test/Downloader/Util/FilesystemTest.php b/tests/Composer/Test/Downloader/Util/FilesystemTest.php index 01a3189b8..243dfa7aa 100644 --- a/tests/Composer/Test/Downloader/Util/FilesystemTest.php +++ b/tests/Composer/Test/Downloader/Util/FilesystemTest.php @@ -51,6 +51,7 @@ class FilesystemTest extends TestCase array('C:/Temp', 'C:\Temp\test', true, "__DIR__ . '/test'"), array('/tmp/test', '/tmp', true, "dirname(__DIR__)"), array('/tmp', '/tmp/test', true, "__DIR__ . '/test'"), + array('C:/Temp', 'c:\Temp\test', true, "__DIR__ . '/test'"), ); } @@ -81,6 +82,7 @@ class FilesystemTest extends TestCase array('/tmp/test/sub', '/tmp', "../"), array('/tmp', '/tmp/test', "test"), array('C:/Temp', 'C:\Temp\test', "test"), + array('C:/Temp', 'c:\Temp\test', "test"), ); } }