Fix require of platform packages with --ignore-platform-reqs, fixes #8012
parent
6bce9da8c8
commit
d96d046209
|
@ -694,15 +694,22 @@ EOT
|
||||||
{
|
{
|
||||||
// find the latest version allowed in this pool
|
// find the latest version allowed in this pool
|
||||||
$versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
|
$versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
|
||||||
$package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
|
$ignorePlatformReqs = $input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs');
|
||||||
|
|
||||||
// retry without phpVersion if platform requirements are ignored in case nothing was found
|
// ignore phpVersion if platform requirements are ignored
|
||||||
if ($input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs')) {
|
if ($ignorePlatformReqs) {
|
||||||
$phpVersion = null;
|
$phpVersion = null;
|
||||||
$package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
|
||||||
|
|
||||||
if (!$package) {
|
if (!$package) {
|
||||||
|
// platform packages can not be found in the pool in versions other than the local platform's has
|
||||||
|
// so if platform reqs are ignored we just take the user's word for it
|
||||||
|
if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
|
||||||
|
return array($name, $requiredVersion ?: '*');
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether the PHP version was the problem
|
// Check whether the PHP version was the problem
|
||||||
if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
|
if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
|
||||||
throw new \InvalidArgumentException(sprintf(
|
throw new \InvalidArgumentException(sprintf(
|
||||||
|
|
Loading…
Reference in New Issue