From 6de7feeb8662e705d8d961527efb0019fd413d5f Mon Sep 17 00:00:00 2001 From: Niels Keurentjes Date: Tue, 25 Oct 2016 09:54:03 +0200 Subject: [PATCH] Fix crash when listing root package without versions When using certain parameters together in 'composer show', specifically '-s --outdated', the root package itself is inspected for its latest version. If the git repository it belongs to does not have any tags yet this would return FALSE, while the next call to printMeta requires a PackageInterface or NULL, causing a crash. Refs #5808 --- src/Composer/Command/ShowCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index b00348f08..e36fed258 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -178,7 +178,7 @@ EOT if ($input->getOption('latest')) { $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion); } - $this->printMeta($package, $versions, $installedRepo, $latestPackage); + $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null); $this->printLinks($package, 'requires'); $this->printLinks($package, 'devRequires', 'requires (dev)'); if ($package->getSuggests()) {