From dcd7f2180d8ebf6cd1bbe23833188dedcd9ba7ec Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 5 Jul 2022 22:20:33 +0200 Subject: [PATCH] Avoid checking for allowed plugins if plugins are disabled entirely, fixes #10925 --- src/Composer/Installer/PluginInstaller.php | 4 ++-- src/Composer/Plugin/PluginManager.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Composer/Installer/PluginInstaller.php b/src/Composer/Installer/PluginInstaller.php index 16bbd4b96..14d8caf9b 100644 --- a/src/Composer/Installer/PluginInstaller.php +++ b/src/Composer/Installer/PluginInstaller.php @@ -52,8 +52,8 @@ class PluginInstaller extends LibraryInstaller */ public function prepare($type, PackageInterface $package, PackageInterface $prevPackage = null) { - // fail install process early if it going to fail due to a plugin not being allowed - if ($type === 'install' || $type === 'update') { + // fail install process early if it is going to fail due to a plugin not being allowed + if (($type === 'install' || $type === 'update') && !$this->composer->getPluginManager()->arePluginsDisabled()) { $this->composer->getPluginManager()->isPluginAllowed($package->getName(), false); } diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index 3cfb3fac9..1210dd189 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -678,6 +678,16 @@ class PluginManager return $rules; } + /** + * @internal + * + * @return bool + */ + public function arePluginsDisabled() + { + return $this->disablePlugins; + } + /** * @internal *