diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 49905aa7a..32eb4f36c 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -258,13 +258,19 @@ EOT } uasort($versions, 'version_compare'); - $versions = implode(', ', array_keys(array_reverse($versions))); + $versions = array_keys(array_reverse($versions)); // highlight installed version if ($installedRepo->hasPackage($package)) { - $versions = str_replace($package->getPrettyVersion(), '* ' . $package->getPrettyVersion() . '', $versions); + $installedVersion = $package->getPrettyVersion(); + $key = array_search($installedVersion, $versions); + if (FALSE !== $key) { + $versions[$key] = '* ' . $installedVersion . ''; + } } + $versions = implode(', ', $versions); + $output->writeln('versions : ' . $versions); }