Explorar o código

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

Jordi Boggiano %!s(int64=5) %!d(string=hai) anos
pai
achega
8958f40f94
Modificáronse 2 ficheiros con 11 adicións e 0 borrados
  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}
      */