소스 검색

Fix ConsoleIO::select regression in which 1.5.3-1.6.2 returned the selected values instead of index keys, fixes #7000

Jordi Boggiano 7 년 전
부모
커밋
a567501e58
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      src/Composer/IO/ConsoleIO.php

+ 10 - 1
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;
     }
 
     /**