1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 17:12:51 +00:00

Fix validating array loader handling of invalid target branch datatype

This commit is contained in:
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

View file

@ -347,6 +347,13 @@ class ValidatingArrayLoader implements LoaderInterface
$this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
} else {
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
if ('-dev' !== substr($targetBranch, -4)) {
$this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';