From ff03bfcdd8249847cfef3a695b718c987148ce70 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 10 Feb 2023 08:30:24 +0100 Subject: [PATCH] Fix keeping platform requirements when rebooting composer --- src/Composer/Plugin.php | 3 +++ tests/install.sh | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Composer/Plugin.php b/src/Composer/Plugin.php index a59cf95..6009b07 100644 --- a/src/Composer/Plugin.php +++ b/src/Composer/Plugin.php @@ -177,6 +177,9 @@ public function postUpdate(Event $event) $composer->getEventDispatcher(), $composer->getAutoloadGenerator() ); + if (method_exists($installer, 'setPlatformRequirementFilter')) { + $installer->setPlatformRequirementFilter(((array) $trace['object'])["\0*\0platformRequirementFilter"]); + } if (0 !== $installer->run()) { file_put_contents(Factory::getComposerFile(), $composerJsonContents); diff --git a/tests/install.sh b/tests/install.sh index 01da882..33caeb4 100755 --- a/tests/install.sh +++ b/tests/install.sh @@ -17,7 +17,8 @@ echo "Using directory: ${BUILD_DIR}" mkdir -p $BUILD_DIR # Init composer -composer req --working-dir $BUILD_DIR php-http/discovery --no-update +composer req --working-dir $BUILD_DIR php-http/discovery --no-update --no-plugins +composer config --working-dir $BUILD_DIR --no-plugins allow-plugins.php-http/discovery false # Argument 3 installs additional composer packages composer req --working-dir $BUILD_DIR $3