diff --git a/src/Composer/Config.php b/src/Composer/Config.php index 86e318765..a144467aa 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -124,7 +124,7 @@ class Config } // disable a repository with an anonymous {"name": false} repo - if (1 === count($repository) && false === current($repository)) { + if (is_array($repository) && 1 === count($repository) && false === current($repository)) { unset($this->repositories[key($repository)]); continue; } diff --git a/tests/Composer/Test/ConfigTest.php b/tests/Composer/Test/ConfigTest.php index 99970125c..e50af5e87 100644 --- a/tests/Composer/Test/ConfigTest.php +++ b/tests/Composer/Test/ConfigTest.php @@ -97,6 +97,18 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ), ); + $data['incorrect local config does not cause ErrorException'] = array( + array( + 'packagist' => array('type' => 'composer', 'url' => 'https?://packagist.org', 'allow_ssl_downgrade' => true), + 'type' => 'vcs', + 'url' => 'http://example.com', + ), + array( + 'type' => 'vcs', + 'url' => 'http://example.com', + ), + ); + return $data; }