1
0
Fork 0

Allow stream wrapper usage in config dirs, fixes #4788

pull/4831/head
Jordi Boggiano 2016-01-25 23:40:16 +00:00
parent e0ff9598c3
commit 03e0d65f37
2 changed files with 11 additions and 1 deletions

View File

@ -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;
}

View File

@ -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');