From ef2856ef55715027ce2275f3b3bf1e84bfc778a4 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 29 Oct 2015 22:35:01 +0000 Subject: [PATCH] Take php version into account for create-project command version selection --- src/Composer/Command/CreateProjectCommand.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 11a176389..f1e5fc459 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -276,9 +276,12 @@ EOT $pool = new Pool($stability); $pool->addRepository($sourceRepo); + // using those 3 constants to build a version without the 'extra' bit that can contain garbage + $phpVersion = PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION; + // find the latest version if there are multiple $versionSelector = new VersionSelector($pool); - $package = $versionSelector->findBestCandidate($name, $packageVersion); + $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion); if (!$package) { throw new \InvalidArgumentException("Could not find package $name" . ($packageVersion ? " with version $packageVersion." : " with stability $stability."));