1
0
Fork 0

Fix: ValidatingArrayLoader [TypeError]: strcasecmp(): Argument #1() must be of type string, int given (#10897)

pull/10904/head
Stephan 2022-06-24 09:30:33 +01:00 committed by GitHub
parent 30a8b82b15
commit 6776cef441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -252,6 +252,7 @@ class ValidatingArrayLoader implements LoaderInterface
foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
foreach ($this->config[$linkType] as $package => $constraint) {
$package = (string) $package;
if (0 === strcasecmp($package, $this->config['name'])) {
$this->errors[] = $linkType.'.'.$package.' : a package cannot set a '.$linkType.' on itself';
unset($this->config[$linkType][$package]);

View File

@ -419,6 +419,13 @@ class ValidatingArrayLoaderTest extends TestCase
'dist.url : must be present',
),
),
array(
array(
'name' => 'foo/bar',
'replace' => array('acme/bar'),
),
array('replace.0 : invalid version constraint (Could not parse version constraint acme/bar: Invalid version string "acme/bar")')
),
));
}