From 73e9db5d9952d52a46ecbc20a269a8c5f9c5b011 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 7 Oct 2014 16:03:19 +0100 Subject: [PATCH] Fix the problem at the source, refs #3322 --- src/Composer/Command/InitCommand.php | 3 ++- src/Composer/Repository/ArrayRepository.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 59ef2d379..84bda9d90 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -333,7 +333,8 @@ EOT } while (null !== $package = $dialog->ask($output, $prompt)) { - $matches = array_values($this->findPackages($package)); + $matches = $this->findPackages($package); + if (count($matches)) { $exactMatch = null; $choices = array(); diff --git a/src/Composer/Repository/ArrayRepository.php b/src/Composer/Repository/ArrayRepository.php index 9b60b8db8..f08f9cda7 100644 --- a/src/Composer/Repository/ArrayRepository.php +++ b/src/Composer/Repository/ArrayRepository.php @@ -98,7 +98,7 @@ class ArrayRepository implements RepositoryInterface } } - return $matches; + return array_values($matches); } /**