From a567501e58e0fc138daa50cbc29a07a0e4ea3e3d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 24 Jan 2018 10:19:21 +0100 Subject: [PATCH] Fix ConsoleIO::select regression in which 1.5.3-1.6.2 returned the selected values instead of index keys, fixes #7000 --- src/Composer/IO/ConsoleIO.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Composer/IO/ConsoleIO.php b/src/Composer/IO/ConsoleIO.php index f3a99edf2..bef7cea9f 100644 --- a/src/Composer/IO/ConsoleIO.php +++ b/src/Composer/IO/ConsoleIO.php @@ -289,7 +289,16 @@ class ConsoleIO extends BaseIO $question->setErrorMessage($errorMessage); $question->setMultiselect($multiselect); - return $helper->ask($this->input, $this->getErrorOutput(), $question); + $result = $helper->ask($this->input, $this->getErrorOutput(), $question); + + $results = array(); + foreach ($choices as $index => $choice) { + if (in_array($choice, $result, true)) { + $results[] = (string) $index; + } + } + + return $results; } /**