ソースを参照

Allow stream wrapper usage in config dirs, fixes #4788

Jordi Boggiano 9 年 前
コミット
03e0d65f37
2 ファイル変更11 行追加1 行削除
  1. 1 1
      src/Composer/Config.php
  2. 10 0
      tests/Composer/Test/ConfigTest.php

+ 1 - 1
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;
         }
 

+ 10 - 0
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');