From a5fdc00de1d9040aaa1ad8e65391716167b3dd11 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 23 Jun 2022 13:39:39 +0200 Subject: [PATCH 1/2] Remove duplicate function in RootPackageInterface, fixes #10895 --- src/Composer/Package/RootPackageInterface.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Composer/Package/RootPackageInterface.php b/src/Composer/Package/RootPackageInterface.php index 32cc44750..14f80ae13 100644 --- a/src/Composer/Package/RootPackageInterface.php +++ b/src/Composer/Package/RootPackageInterface.php @@ -113,15 +113,6 @@ interface RootPackageInterface extends CompletePackageInterface */ public function setReplaces(array $replaces); - /** - * Set the repositories - * - * @param mixed[] $repositories - * - * @return void - */ - public function setRepositories(array $repositories); - /** * Set the autoload mapping * From 6776cef441d19a87e527f00b5465c01d1c9c959f Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 24 Jun 2022 09:30:33 +0100 Subject: [PATCH 2/2] Fix: ValidatingArrayLoader [TypeError]: strcasecmp(): Argument #1() must be of type string, int given (#10897) --- src/Composer/Package/Loader/ValidatingArrayLoader.php | 1 + .../Test/Package/Loader/ValidatingArrayLoaderTest.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index e5d513c41..7e4318b85 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -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]); diff --git a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php index e3d6103e1..4562a2702 100644 --- a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php @@ -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")') + ), )); }