From bca786d5c33eaeb9242b1273a279146ec5f3bbbe Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 16 Jan 2012 22:40:14 +0100 Subject: [PATCH] Fixed the tests array_filter preserves the keys even when filtering an array indexed numerically. --- src/Composer/Repository/ArrayRepository.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Composer/Repository/ArrayRepository.php b/src/Composer/Repository/ArrayRepository.php index 8d3898f3d..36ed56b0b 100644 --- a/src/Composer/Repository/ArrayRepository.php +++ b/src/Composer/Repository/ArrayRepository.php @@ -48,10 +48,15 @@ class ArrayRepository implements RepositoryInterface { // normalize name $name = strtolower($name); + $packages = array(); - return array_filter($this->getPackages(), function (PackageInterface $package) use ($name) { - return $package->getName() === $name; - }); + foreach ($this->getPackages() as $package) { + if ($package->getName() === $name) { + $packages[] = $package; + } + } + + return $packages; } /**