From 8958f40f94239320f9849b2c3cfe31cad2f6b40c Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 29 Jul 2019 17:57:18 +0200 Subject: [PATCH] Make sure resetting composer also resets the IO and configuration, fixes #8224 --- src/Composer/Console/Application.php | 3 +++ src/Composer/IO/BaseIO.php | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index fe5dbaccf..d7d113492 100644 --- a/src/Composer/Console/Application.php +++ b/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(); + } } /** diff --git a/src/Composer/IO/BaseIO.php b/src/Composer/IO/BaseIO.php index b327f1bbf..8f61c863d 100644 --- a/src/Composer/IO/BaseIO.php +++ b/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} */