From 641ad10a9f32cd5a9b10d54c39ddd358986dc3e6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 7 Jan 2022 13:46:58 +0100 Subject: [PATCH 1/3] Fix partial update where path repos are being auto-unlocked two levels deep not loading all packages properly, fixes #10431 --- src/Composer/DependencyResolver/PoolBuilder.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Composer/DependencyResolver/PoolBuilder.php b/src/Composer/DependencyResolver/PoolBuilder.php index 9ff306324..de7626fe4 100644 --- a/src/Composer/DependencyResolver/PoolBuilder.php +++ b/src/Composer/DependencyResolver/PoolBuilder.php @@ -459,6 +459,10 @@ class PoolBuilder } } } + } elseif (isset($this->pathRepoUnlocked[$require]) && !isset($this->loadedPackages[$require])) { + // if doing a partial update and a package depends on a path-repo-unlocked package which is not referenced by the root, we need to ensure it gets loaded as it was not loaded by the request's root requirements + // and would not be loaded above if update propagation is not allowed (which happens if the requirer is itself a path-repo-unlocked package) or if transitive deps are not allowed to be unlocked + $this->markPackageNameForLoading($request, $require, $linkConstraint); } } else { $this->markPackageNameForLoading($request, $require, $linkConstraint); From 9305dea128a751b42287577e8314c462c8dca0e2 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 7 Jan 2022 13:50:00 +0100 Subject: [PATCH 2/3] Only run getenv workaround on PHP 7.1.13+ --- bin/composer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/composer b/bin/composer index 32c45bcda..6aaa4533d 100755 --- a/bin/composer +++ b/bin/composer @@ -67,7 +67,7 @@ if (function_exists('ini_set')) { // Workaround PHP bug on Windows where env vars containing Unicode chars are mangled in $_SERVER // see https://github.com/php/php-src/issues/7896 -if (Platform::isWindows()) { +if (PHP_VERSION_ID >= 70113 && Platform::isWindows()) { $_SERVER = array_merge($_SERVER, array_intersect_ukey($_SERVER, getenv(), 'strcasecmp')); } From d9619985dbabb58255fb27cf78fe702345d31793 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 7 Jan 2022 13:57:17 +0100 Subject: [PATCH 3/3] Workaround PHP bug properly as getenv() without arg also returns mangled values, fixes #10434 --- bin/composer | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/composer b/bin/composer index 6aaa4533d..9bb3559a4 100755 --- a/bin/composer +++ b/bin/composer @@ -68,7 +68,11 @@ if (function_exists('ini_set')) { // Workaround PHP bug on Windows where env vars containing Unicode chars are mangled in $_SERVER // see https://github.com/php/php-src/issues/7896 if (PHP_VERSION_ID >= 70113 && Platform::isWindows()) { - $_SERVER = array_merge($_SERVER, array_intersect_ukey($_SERVER, getenv(), 'strcasecmp')); + foreach ($_SERVER as $serverVar => $serverVal) { + if (($serverVal = getenv($serverVar)) !== false) { + $_SERVER[$serverVar] = $serverVal; + } + } } Platform::putEnv('COMPOSER_BINARY', realpath($_SERVER['argv'][0]));