From 2a35486d7dc5dc6408bcb480ee11cae86c8117e3 Mon Sep 17 00:00:00 2001 From: Rick Guyer Date: Fri, 4 Mar 2016 12:48:43 -0600 Subject: [PATCH] Check for --ignore-platform-reqs flag during create-project During `create-project`, the installed PHP version was used to determine the best root package install candidate, but failed to take into account the `--ignore-platform-reqs` flag. --- src/Composer/Command/CreateProjectCommand.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index e74e2e56f..519fa67a8 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -143,7 +143,7 @@ EOT $io->loadConfiguration($config); if ($packageName !== null) { - $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $keepVcs, $noProgress); + $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $keepVcs, $noProgress, $ignorePlatformReqs); } else { $installedFromVcs = false; } @@ -239,7 +239,7 @@ EOT return 0; } - protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false) + protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $ignorePlatformReqs = false) { if (null === $repository) { $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config)); @@ -271,8 +271,11 @@ 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; + $phpVersion = null; + if (!$ignorePlatformReqs) { + // 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);