From 93eb19e756aac57d134cb0350e42cbced2befc57 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 17 Jul 2022 10:22:07 +0200 Subject: [PATCH 1/3] For custom composer.json paths the default cwd should be that files directory, fixes ergebnis/composer-normalize#865, refs #10935 --- src/Composer/Factory.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 609c1cc24..c8d1fc3d8 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -303,6 +303,11 @@ class Factory */ public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true, $disableScripts = false) { + // if a custom composer.json path is given, we change the default cwd to be that file's directory + if (is_string($localConfig) && is_file($localConfig) && null === $cwd) { + $cwd = dirname($localConfig); + } + $cwd = $cwd ?: (string) getcwd(); // load Composer configuration From 740af2bdb16ce9249da9b7266ee49e67b679f336 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 17 Jul 2022 10:29:56 +0200 Subject: [PATCH 2/3] Add warning if constraint appears too narrow, refs #10943 --- src/Composer/Command/InitCommand.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 75bc92dd2..b4ea4350d 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -530,6 +530,10 @@ EOT $io = $this->getIO(); foreach ($requires as $requirement) { + if (isset($requirement['version']) && Preg::isMatch('{^\d+(\.\d+)?$}', $requirement['version'])) { + $io->writeError('The "'.$requirement['version'].'" constraint for "'.$requirement['name'].'" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints'); + } + if (!isset($requirement['version'])) { // determine the best version automatically list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $platformRepo, $preferredStability, null, null, $fixed); From 8d5bdaf443ed924cf49a1981b5c566020d0d1beb Mon Sep 17 00:00:00 2001 From: Sam Litowitz Date: Wed, 13 Jul 2022 09:19:35 -0400 Subject: [PATCH 3/3] Fixes #10938: Do not display duplicate ignore extension hints --- src/Composer/DependencyResolver/SolverProblemsException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/DependencyResolver/SolverProblemsException.php b/src/Composer/DependencyResolver/SolverProblemsException.php index deaec7d24..33a122ad9 100644 --- a/src/Composer/DependencyResolver/SolverProblemsException.php +++ b/src/Composer/DependencyResolver/SolverProblemsException.php @@ -119,7 +119,7 @@ class SolverProblemsException extends \RuntimeException $ignoreExtensionsArguments = implode(" ", array_map(function ($extension) { return "--ignore-platform-req=$extension"; - }, $missingExtensions)); + }, array_unique($missingExtensions))); $text = "To enable extensions, verify that they are enabled in your .ini files:\n - "; $text .= implode("\n - ", $paths);