From de6432f5f013e240f87584c752a8a1acdd5e9d58 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 27 Jul 2018 10:59:36 +0200 Subject: [PATCH] Show overridden php version in diagnose command, fixes #7497 --- src/Composer/Command/DiagnoseCommand.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Composer/Command/DiagnoseCommand.php b/src/Composer/Command/DiagnoseCommand.php index ada5faa87..3efb34973 100644 --- a/src/Composer/Command/DiagnoseCommand.php +++ b/src/Composer/Command/DiagnoseCommand.php @@ -16,6 +16,7 @@ use Composer\Composer; use Composer\Factory; use Composer\Config; use Composer\Downloader\TransportException; +use Composer\Repository\PlatformRepository; use Composer\Plugin\CommandEvent; use Composer\Plugin\PluginEvents; use Composer\Util\ConfigValidator; @@ -153,7 +154,15 @@ EOT $io->write(sprintf('Composer version: %s', Composer::VERSION)); - $io->write(sprintf('PHP version: %s', PHP_VERSION)); + $platformOverrides = $config->get('platform') ?: array(); + $platformRepo = new PlatformRepository(array(), $platformOverrides); + $phpPkg = $platformRepo->findPackage('php', '*'); + $phpVersion = $phpPkg->getPrettyVersion(); + if (false !== strpos($phpPkg->getDescription(), 'overridden')) { + $phpVersion .= ' - ' . $phpPkg->getDescription(); + } + + $io->write(sprintf('PHP version: %s', $phpVersion)); if (defined('PHP_BINARY')) { $io->write(sprintf('PHP binary path: %s', PHP_BINARY));