Allow stream wrapper usage in config dirs, fixes #4788

main
Jordi Boggiano 9 years ago
parent e0ff9598c3
commit 03e0d65f37

@ -345,7 +345,7 @@ class Config
*/ */
private function realpath($path) 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; return $path;
} }

@ -148,6 +148,16 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('/baz', $config->get('cache-dir')); $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() public function testFetchingRelativePaths()
{ {
$config = new Config(false, '/foo/bar'); $config = new Config(false, '/foo/bar');

Loading…
Cancel
Save