diff --git a/src/Composer/Config.php b/src/Composer/Config.php index a1b0246b9..e8fdf2561 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -345,7 +345,7 @@ class Config */ private function realpath($path) { - if (substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':') { + if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) { return $path; } diff --git a/tests/Composer/Test/ConfigTest.php b/tests/Composer/Test/ConfigTest.php index 88d8a15d3..ca3e54ce7 100644 --- a/tests/Composer/Test/ConfigTest.php +++ b/tests/Composer/Test/ConfigTest.php @@ -148,6 +148,16 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/baz', $config->get('cache-dir')); } + public function testStreamWrapperDirs() + { + $config = new Config(false, '/foo/bar'); + $config->merge(array('config' => array( + 'cache-dir' => 's3://baz/', + ))); + + $this->assertEquals('s3://baz', $config->get('cache-dir')); + } + public function testFetchingRelativePaths() { $config = new Config(false, '/foo/bar');