Skip to content

Commit

Permalink
Fix: ValidatingArrayLoader [TypeError]: strcasecmp(): Argument compos…
Browse files Browse the repository at this point in the history
…er#1() must be of type string, int given (composer#10897)
  • Loading branch information
glaubinix authored and emahorvat52 committed Jan 18, 2023
1 parent e90be2d commit 60c6319
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 60c6319

Please sign in to comment.