mirror of
https://github.com/composer/composer
synced 2025-05-11 09:32:55 +00:00
Improve validating array loader to avoid false positives
This commit is contained in:
parent
e7e04689f1
commit
e05391dc44
3 changed files with 9 additions and 5 deletions
|
@ -50,14 +50,14 @@ class ValidatingArrayLoader implements LoaderInterface
|
|||
}
|
||||
}
|
||||
|
||||
$this->validateRegex('type', '[a-z0-9-]+');
|
||||
$this->validateRegex('type', '[A-Za-z0-9-]+');
|
||||
$this->validateString('target-dir');
|
||||
$this->validateArray('extra');
|
||||
$this->validateFlatArray('bin');
|
||||
$this->validateArray('scripts'); // TODO validate event names & listener syntax
|
||||
$this->validateString('description');
|
||||
$this->validateUrl('homepage');
|
||||
$this->validateFlatArray('keywords', '[A-Za-z0-9 -]+');
|
||||
$this->validateFlatArray('keywords', '[A-Za-z0-9 ._-]+');
|
||||
|
||||
if (isset($this->config['license'])) {
|
||||
if (is_string($this->config['license'])) {
|
||||
|
@ -302,7 +302,7 @@ class ValidatingArrayLoader implements LoaderInterface
|
|||
}
|
||||
|
||||
if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
|
||||
$this->errors[] = $property.'.'.$key.' : invalid value, must match '.$regex;
|
||||
$this->warnings[] = $property.'.'.$key.' : invalid value, must match '.$regex;
|
||||
unset($this->config[$property][$key]);
|
||||
$pass = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue