From 5f0aa0142822bbaa8b40653b35ad0117452fc265 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 12 Oct 2022 14:10:47 +0200 Subject: [PATCH 1/3] Update deps --- composer.lock | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/composer.lock b/composer.lock index 42093a779..9e1be235c 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "composer/ca-bundle", - "version": "1.3.3", + "version": "1.3.4", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "30897edbfb15e784fe55587b4f73ceefd3c4d98c" + "reference": "69098eca243998b53eed7a48d82dedd28b447cd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/30897edbfb15e784fe55587b4f73ceefd3c4d98c", - "reference": "30897edbfb15e784fe55587b4f73ceefd3c4d98c", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/69098eca243998b53eed7a48d82dedd28b447cd5", + "reference": "69098eca243998b53eed7a48d82dedd28b447cd5", "shasum": "" }, "require": { @@ -64,7 +64,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.3.3" + "source": "https://github.com/composer/ca-bundle/tree/1.3.4" }, "funding": [ { @@ -80,7 +80,7 @@ "type": "tidelift" } ], - "time": "2022-07-20T07:14:26+00:00" + "time": "2022-10-12T12:08:29+00:00" }, { "name": "composer/class-map-generator", @@ -941,16 +941,16 @@ }, { "name": "symfony/console", - "version": "v5.4.13", + "version": "v5.4.14", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be" + "reference": "984ea2c0f45f42dfed01d2f3987b187467c4b16d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be", - "reference": "3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be", + "url": "https://api.github.com/repos/symfony/console/zipball/984ea2c0f45f42dfed01d2f3987b187467c4b16d", + "reference": "984ea2c0f45f42dfed01d2f3987b187467c4b16d", "shasum": "" }, "require": { @@ -1020,7 +1020,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.13" + "source": "https://github.com/symfony/console/tree/v5.4.14" }, "funding": [ { @@ -1036,7 +1036,7 @@ "type": "tidelift" } ], - "time": "2022-08-26T13:50:20+00:00" + "time": "2022-10-07T08:01:20+00:00" }, { "name": "symfony/deprecation-contracts", @@ -1871,16 +1871,16 @@ }, { "name": "symfony/string", - "version": "v5.4.13", + "version": "v5.4.14", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "2900c668a32138a34118740de3e4d5a701801f53" + "reference": "089e7237497fae7a9c404d0c3aeb8db3254733e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/2900c668a32138a34118740de3e4d5a701801f53", - "reference": "2900c668a32138a34118740de3e4d5a701801f53", + "url": "https://api.github.com/repos/symfony/string/zipball/089e7237497fae7a9c404d0c3aeb8db3254733e4", + "reference": "089e7237497fae7a9c404d0c3aeb8db3254733e4", "shasum": "" }, "require": { @@ -1937,7 +1937,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.13" + "source": "https://github.com/symfony/string/tree/v5.4.14" }, "funding": [ { @@ -1953,7 +1953,7 @@ "type": "tidelift" } ], - "time": "2022-09-01T01:52:16+00:00" + "time": "2022-10-05T15:16:54+00:00" } ], "packages-dev": [ @@ -2239,16 +2239,16 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v6.1.3", + "version": "v6.1.6", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "75c2fa71d049c1f48e39d208c0cefba97e66335a" + "reference": "07cf788ac9ae83b59d46599bb5098c3add88c68b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/75c2fa71d049c1f48e39d208c0cefba97e66335a", - "reference": "75c2fa71d049c1f48e39d208c0cefba97e66335a", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/07cf788ac9ae83b59d46599bb5098c3add88c68b", + "reference": "07cf788ac9ae83b59d46599bb5098c3add88c68b", "shasum": "" }, "require": { @@ -2302,7 +2302,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v6.1.3" + "source": "https://github.com/symfony/phpunit-bridge/tree/v6.1.6" }, "funding": [ { @@ -2318,7 +2318,7 @@ "type": "tidelift" } ], - "time": "2022-07-28T13:40:41+00:00" + "time": "2022-10-07T08:04:03+00:00" } ], "aliases": [], From d06796efcfc6b3273543d402b6d0e2ff131f4347 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 12 Oct 2022 15:31:59 +0200 Subject: [PATCH 2/3] Warn if why-not is used with a version which does not exist/is not found, fixes #11070 --- src/Composer/Command/BaseDependencyCommand.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Composer/Command/BaseDependencyCommand.php b/src/Composer/Command/BaseDependencyCommand.php index 76a9c5fb6..1d60e168b 100644 --- a/src/Composer/Command/BaseDependencyCommand.php +++ b/src/Composer/Command/BaseDependencyCommand.php @@ -94,6 +94,9 @@ abstract class BaseDependencyCommand extends BaseCommand 2, $input->hasArgument(self::ARGUMENT_CONSTRAINT) ? $input->getArgument(self::ARGUMENT_CONSTRAINT) : '*' ); + if (!$input->hasArgument(self::ARGUMENT_CONSTRAINT)) { + $textConstraint = '*'; + } // Find packages that are or provide the requested package first $packages = $installedRepo->findPackagesWithReplacersAndProviders($needle); @@ -107,6 +110,8 @@ abstract class BaseDependencyCommand extends BaseCommand $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO(), $composer->getConfig(), $composer->getRepositoryManager())); if ($match = $defaultRepos->findPackage($needle, $textConstraint)) { $installedRepo->addRepository(new InstalledArrayRepository([clone $match])); + } else { + $this->getIO()->writeError('Package "'.$needle.'" could not be found with constraint "'.$textConstraint.'", results below will most likely be incomplete.'); } } From 8618f004f791144dc33a196a5e5346ab56f77f7b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 12 Oct 2022 16:16:31 +0200 Subject: [PATCH 3/3] Fix parsing of aliases used within complex OR constraints, fixes #11086 --- .../Package/Loader/RootPackageLoader.php | 2 +- .../alias-in-complex-constraints.test | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/Composer/Test/Fixtures/installer/alias-in-complex-constraints.test diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index ffb553671..a1df59622 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -193,7 +193,7 @@ class RootPackageLoader extends ArrayLoader private function extractAliases(array $requires, array $aliases): array { foreach ($requires as $reqName => $reqVersion) { - if (Preg::isMatch('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) { + if (Preg::isMatch('{(?:^|\| *|, *)([^,\s#|]+)(?:#[^ ]+)? +as +([^,\s|]+)(?:$| *\|| *,)}', $reqVersion, $match)) { $aliases[] = [ 'package' => strtolower($reqName), 'version' => $this->versionParser->normalize($match[1], $reqVersion), diff --git a/tests/Composer/Test/Fixtures/installer/alias-in-complex-constraints.test b/tests/Composer/Test/Fixtures/installer/alias-in-complex-constraints.test new file mode 100644 index 000000000..de6835880 --- /dev/null +++ b/tests/Composer/Test/Fixtures/installer/alias-in-complex-constraints.test @@ -0,0 +1,58 @@ +--TEST-- +Aliases can be extracted out of complex AND or OR constraints +--COMPOSER-- +{ + "repositories": [ + { + "type": "package", + "package": [ + { + "name": "a/a", "version": "dev-feature-foo", + "source": { "reference": "feat.a", "type": "git", "url": "" } + }, + { + "name": "a/b", "version": "dev-feature-foo", + "source": { "reference": "feat.b", "type": "git", "url": "" } + }, + { + "name": "a/c", "version": "dev-feature-foo", + "source": { "reference": "feat.c", "type": "git", "url": "" } + }, + { + "name": "a/d", "version": "dev-feature-foo", + "source": { "reference": "feat.d", "type": "git", "url": "" } + }, + { + "name": "enforcer/pkg", "version": "1.0.0", + "source": { "reference": "feat.c", "type": "git", "url": "" }, + "require": { + "a/a": "^1", + "a/b": "^1", + "a/c": "^1", + "a/d": "^1" + } + } + ] + } + ], + "require": { + "a/a": "1.*||dev-feature-foo as 1.0.2||^2", + "a/b": "dev-feature-foo, dev-feature-foo as 1.0.2", + "a/c": "dev-feature-foo as 1.0.2||^2", + "a/d": "dev-feature-foo as 1.0.2, dev-feature-foo", + "enforcer/pkg": "*" + }, + "minimum-stability": "dev" +} +--RUN-- +install +--EXPECT-- +Installing a/d (dev-feature-foo feat.d) +Marking a/d (1.0.2) as installed, alias of a/d (dev-feature-foo feat.d) +Installing a/c (dev-feature-foo feat.c) +Marking a/c (1.0.2) as installed, alias of a/c (dev-feature-foo feat.c) +Installing a/b (dev-feature-foo feat.b) +Marking a/b (1.0.2) as installed, alias of a/b (dev-feature-foo feat.b) +Installing a/a (dev-feature-foo feat.a) +Marking a/a (1.0.2) as installed, alias of a/a (dev-feature-foo feat.a) +Installing enforcer/pkg (1.0.0)