Skip to content

Commit

Permalink
Fix: ValidatingArrayLoader [TypeError]: strcasecmp(): Argument #1() m…
Browse files Browse the repository at this point in the history
…ust be of type string, int given (#10897)
  • Loading branch information
glaubinix committed Jun 24, 2022
1 parent 30a8b82 commit 6776cef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Composer/Package/Loader/ValidatingArrayLoader.php
Expand Up @@ -252,6 +252,7 @@ public function load(array $config, string $class = 'Composer\Package\CompletePa
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]);
Expand Down
Expand Up @@ -419,6 +419,13 @@ public function errorProvider(): array
'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")')
),
));
}

Expand Down

0 comments on commit 6776cef

Please sign in to comment.