1
0
Fork 0

Fix error handling for incorrect "repositories" array

pull/3655/head
Dmitry Tarasov 2015-01-20 13:03:55 +03:00
parent 2a1a963b00
commit 3b678ee379
2 changed files with 13 additions and 1 deletions

View File

@ -124,7 +124,7 @@ class Config
} }
// disable a repository with an anonymous {"name": false} repo // 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)]); unset($this->repositories[key($repository)]);
continue; continue;
} }

View File

@ -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; return $data;
} }