diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index 653ed4b42..d48d853fd 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -81,6 +81,11 @@ class ValidatingArrayLoader implements LoaderInterface $this->validateArray('authors'); if (!empty($this->config['authors'])) { foreach ($this->config['authors'] as $key => $author) { + if (!is_array($author)) { + $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given'; + unset($this->config['authors'][$key]); + continue; + } if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) { $this->errors[] = 'authors.'.$key.'.homepage : invalid value, must be a valid http/https URL'; unset($this->config['authors'][$key]['homepage']); @@ -97,6 +102,9 @@ class ValidatingArrayLoader implements LoaderInterface $this->errors[] = 'authors.'.$key.'.role : invalid value, must be a string'; unset($this->config['authors'][$key]['role']); } + if (empty($this->config['authors'][$key])) { + unset($this->config['authors'][$key]); + } } if (empty($this->config['authors'])) { unset($this->config['authors']);