Browse Source

Fix --no-plugins not working in certain edge cases

Jordi Boggiano 6 years ago
parent
commit
0fdf746ebe

+ 1 - 1
src/Composer/Command/BaseCommand.php

@@ -130,7 +130,7 @@ abstract class BaseCommand extends Command
         $disablePlugins = $input->hasParameterOption('--no-plugins');
         $composer = $this->getComposer(false, $disablePlugins);
         if (null === $composer) {
-            $composer = Factory::createGlobal($this->getIO(), false);
+            $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
         }
         if ($composer) {
             $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());

+ 1 - 1
src/Composer/Command/SearchCommand.php

@@ -60,7 +60,7 @@ EOT
         $platformRepo = new PlatformRepository;
         $io = $this->getIO();
         if (!($composer = $this->getComposer(false))) {
-            $composer = Factory::create($this->getIO(), array());
+            $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
         }
         $localRepo = $composer->getRepositoryManager()->getLocalRepository();
         $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));

+ 1 - 1
src/Composer/Command/ValidateCommand.php

@@ -89,7 +89,7 @@ EOT
         list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
 
         $lockErrors = array();
-        $composer = Factory::create($io, $file);
+        $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
         $locker = $composer->getLocker();
         if ($locker->isLocked() && !$locker->isFresh()) {
             $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';