From 952256247c6441d5a444d15c1607228a6d97316f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 26 Jan 2024 17:11:16 +0100 Subject: [PATCH] Only include installed versions class when plugins and scripts are allowed, as it is not needed otherwise --- src/Composer/Factory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index f82a9c390..b198f0f14 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -350,8 +350,8 @@ class Factory // load auth configs into the IO instance $io->loadConfiguration($config); - // load existing Composer\InstalledVersions instance if available - if (!class_exists('Composer\InstalledVersions', false) && file_exists($installedVersionsPath = $config->get('vendor-dir').'/composer/InstalledVersions.php')) { + // load existing Composer\InstalledVersions instance if available and scripts/plugins are allowed, as they might need it + if (!$disablePlugins && !$disableScripts && !class_exists('Composer\InstalledVersions', false) && file_exists($installedVersionsPath = $config->get('vendor-dir').'/composer/InstalledVersions.php')) { include $installedVersionsPath; } }