ArrayLoader: fix integer index of branch alias (#10660)
parent
1fff47bfc7
commit
9f8ee0e40a
|
@ -421,6 +421,8 @@ class ArrayLoader implements LoaderInterface
|
|||
|
||||
if (isset($config['extra']['branch-alias']) && \is_array($config['extra']['branch-alias'])) {
|
||||
foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
|
||||
$sourceBranch = (string) $sourceBranch;
|
||||
|
||||
// ensure it is an alias to a -dev package
|
||||
if ('-dev' !== substr($targetBranch, -4)) {
|
||||
continue;
|
||||
|
|
|
@ -347,4 +347,23 @@ class ArrayLoaderTest extends TestCase
|
|||
$this->assertSame('2019', $package->getSourceReference());
|
||||
$this->assertSame('2019', $package->getDistReference());
|
||||
}
|
||||
|
||||
public function testBranchAliasIntegerIndex(): void
|
||||
{
|
||||
$config = array(
|
||||
'name' => 'acme/package',
|
||||
'version' => 'dev-1',
|
||||
'extra' => [
|
||||
'branch-alias' => [
|
||||
'1' => '1.3-dev',
|
||||
],
|
||||
],
|
||||
'dist' => [
|
||||
'type' => 'zip',
|
||||
'url' => 'https://example.org/',
|
||||
],
|
||||
);
|
||||
|
||||
$this->assertNull($this->loader->getBranchAlias($config));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue