1
0
Fork 0

Make sure invalid authors are purged

pull/1040/merge
Jordi Boggiano 2012-09-08 13:47:08 +02:00
parent fe4516aff8
commit 5b9f190bcd
1 changed files with 8 additions and 0 deletions

View File

@ -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']);