1
0
Fork 0

Fix validating array loader handling of invalid target branch datatype

pull/10086/head
Jordi Boggiano 2021-08-30 13:43:33 +02:00
parent f4e2b389a1
commit 61fba697a0
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 7 additions and 0 deletions

View File

@ -347,6 +347,13 @@ class ValidatingArrayLoader implements LoaderInterface
$this->errors[] = 'extra.branch-alias : must be an array of versions => aliases'; $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
} else { } else {
foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) { foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
if (!is_string($targetBranch)) {
$this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.json_encode($targetBranch).') must be a string, "'.gettype($targetBranch).'" received.';
unset($this->config['extra']['branch-alias'][$sourceBranch]);
continue;
}
// ensure it is an alias to a -dev package // ensure it is an alias to a -dev package
if ('-dev' !== substr($targetBranch, -4)) { if ('-dev' !== substr($targetBranch, -4)) {
$this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev'; $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';