From 08e34858d64740f74c5c5a6fa22b425ef12d6e3e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 5 Jun 2014 11:14:29 +0200 Subject: [PATCH] Fix code to use hostname only, refs #3026 --- src/Composer/Util/Svn.php | 7 ++++--- tests/Composer/Test/Util/SvnTest.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Composer/Util/Svn.php b/src/Composer/Util/Svn.php index e8eb6fc78..a2836075f 100644 --- a/src/Composer/Util/Svn.php +++ b/src/Composer/Util/Svn.php @@ -289,9 +289,10 @@ class Svn $authConfig = $this->config->get('http-basic'); - if (array_key_exists($this->url, $authConfig)) { - $this->credentials['username'] = $authConfig[$this->url]['username']; - $this->credentials['password'] = $authConfig[$this->url]['password']; + $host = parse_url($this->url, PHP_URL_HOST); + if (isset($authConfig[$host])) { + $this->credentials['username'] = $authConfig[$host]['username']; + $this->credentials['password'] = $authConfig[$host]['password']; return $this->hasAuth = true; } diff --git a/tests/Composer/Test/Util/SvnTest.php b/tests/Composer/Test/Util/SvnTest.php index 69fb1c804..95bc6691e 100644 --- a/tests/Composer/Test/Util/SvnTest.php +++ b/tests/Composer/Test/Util/SvnTest.php @@ -60,7 +60,7 @@ class SvnTest extends \PHPUnit_Framework_TestCase $config->merge(array( 'config' => array( 'http-basic' => array( - $url => array('username' => 'foo', 'password' => 'bar') + 'svn.apache.org' => array('username' => 'foo', 'password' => 'bar') ) ) ));