From af1dccb1fb67ae3fc337ae95376ef77658d9a711 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 15 May 2018 15:20:18 +0200 Subject: [PATCH] Avoid showing virtual packages in search results, fixes #7310 --- src/Composer/Repository/ComposerRepository.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 60ab0dfbd..bba67f999 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -201,9 +201,17 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito $hostname = parse_url($url, PHP_URL_HOST) ?: $url; $json = $this->rfs->getContents($hostname, $url, false); - $results = JsonFile::parseJson($json, $url); + $search = JsonFile::parseJson($json, $url); - return $results['results']; + $results = array(); + foreach ($search['results'] as $result) { + // do not show virtual packages in results as they are not directly useful from a composer perspective + if (empty($result['virtual'])) { + $results[] = $result; + } + } + + return $results; } if ($this->hasProviders()) {