Make sure invalid authors are purged
parent
fe4516aff8
commit
5b9f190bcd
|
@ -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']);
|
||||
|
|
Loading…
Reference in New Issue