make sure php version errors are less misleading
* determine conflicting version in problem using pool package * hide version in rule to keep it generic rather than possibly misleading fixes #4319pull/4321/head
parent
a67eaf04c7
commit
77f1d5945f
|
@ -87,8 +87,12 @@ class Problem
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($job && $job['cmd'] === 'install' && empty($packages)) {
|
if ($job && $job['cmd'] === 'install' && empty($packages)) {
|
||||||
|
|
||||||
// handle php/hhvm
|
// handle php/hhvm
|
||||||
if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
|
if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
|
||||||
|
$available = $this->pool->whatProvides($job['packageName']);
|
||||||
|
$version = count($available) ? $available[0]->getPrettyVersion() : phpversion();
|
||||||
|
|
||||||
$msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
|
$msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
|
||||||
|
|
||||||
if (defined('HHVM_VERSION')) {
|
if (defined('HHVM_VERSION')) {
|
||||||
|
@ -97,7 +101,7 @@ class Problem
|
||||||
return $msg . 'you are running this with PHP and not HHVM.';
|
return $msg . 'you are running this with PHP and not HHVM.';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $msg . 'your PHP version ('. phpversion().') does not satisfy that requirement.';
|
return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle php extensions
|
// handle php extensions
|
||||||
|
|
|
@ -199,16 +199,17 @@ class Rule
|
||||||
} else {
|
} else {
|
||||||
$targetName = $this->reasonData->getTarget();
|
$targetName = $this->reasonData->getTarget();
|
||||||
|
|
||||||
// handle php extensions
|
|
||||||
if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
|
if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
|
||||||
|
// handle php/hhvm
|
||||||
if (defined('HHVM_VERSION')) {
|
if (defined('HHVM_VERSION')) {
|
||||||
$text .= ' -> your HHVM version does not satisfy that requirement.';
|
$text .= ' -> your HHVM version does not satisfy that requirement.';
|
||||||
} elseif ($targetName === 'hhvm') {
|
} elseif ($targetName === 'hhvm') {
|
||||||
$text .= ' -> you are running this with PHP and not HHVM.';
|
$text .= ' -> you are running this with PHP and not HHVM.';
|
||||||
} else {
|
} else {
|
||||||
$text .= ' -> your PHP version ('. phpversion().') does not satisfy that requirement.';
|
$text .= ' -> your PHP version does not satisfy that requirement.';
|
||||||
}
|
}
|
||||||
} elseif (0 === strpos($targetName, 'ext-')) {
|
} elseif (0 === strpos($targetName, 'ext-')) {
|
||||||
|
// handle php extensions
|
||||||
$ext = substr($targetName, 4);
|
$ext = substr($targetName, 4);
|
||||||
$error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
|
$error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue