Переглянути джерело

Make sure resetting composer also resets the IO and configuration, fixes #8224

Jordi Boggiano 5 роки тому
батько
коміт
8958f40f94
2 змінених файлів з 11 додано та 0 видалено
  1. 3 0
      src/Composer/Console/Application.php
  2. 8 0
      src/Composer/IO/BaseIO.php

+ 3 - 0
src/Composer/Console/Application.php

@@ -373,6 +373,9 @@ class Application extends BaseApplication
     public function resetComposer()
     {
         $this->composer = null;
+        if ($this->getIO() && method_exists($this->getIO(), 'resetAuthentications')) {
+            $this->getIO()->resetAuthentications();
+        }
     }
 
     /**

+ 8 - 0
src/Composer/IO/BaseIO.php

@@ -29,6 +29,14 @@ abstract class BaseIO implements IOInterface, LoggerInterface
         return $this->authentications;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public function resetAuthentications()
+    {
+        $this->authentications = array();
+    }
+
     /**
      * {@inheritDoc}
      */