1
0
Fork 0

ArrayLoader: handle invalid support value (#11440)

pull/11442/head
Stephan 2023-04-26 14:26:45 +01:00 committed by GitHub
parent e0c1ad1448
commit 11879ea737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -282,7 +282,7 @@ class ArrayLoader implements LoaderInterface
$package->setAuthors($config['authors']); $package->setAuthors($config['authors']);
} }
if (isset($config['support'])) { if (isset($config['support']) && \is_array($config['support'])) {
$package->setSupport($config['support']); $package->setSupport($config['support']);
} }

View File

@ -429,4 +429,16 @@ class ArrayLoaderTest extends TestCase
$package = $this->loader->load($config); $package = $this->loader->load($config);
$this->assertCount(0, $package->getReplaces()); $this->assertCount(0, $package->getReplaces());
} }
public function testSupportStringValue(): void
{
$config = array(
'name' => 'acme/package',
'version' => 'dev-1',
'support' => 'https://example.org',
);
$package = $this->loader->load($config);
$this->assertSame([], $package->getSupport());
}
} }