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 #4319
main
Rob Bast 9 years ago
parent a67eaf04c7
commit 77f1d5945f

@ -87,8 +87,12 @@ class Problem
}
if ($job && $job['cmd'] === 'install' && empty($packages)) {
// handle php/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 ';
if (defined('HHVM_VERSION')) {
@ -97,7 +101,7 @@ class Problem
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

@ -199,16 +199,17 @@ class Rule
} else {
$targetName = $this->reasonData->getTarget();
// handle php extensions
if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
// handle php/hhvm
if (defined('HHVM_VERSION')) {
$text .= ' -> your HHVM version does not satisfy that requirement.';
} elseif ($targetName === 'hhvm') {
$text .= ' -> you are running this with PHP and not HHVM.';
} 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-')) {
// handle php extensions
$ext = substr($targetName, 4);
$error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';

Loading…
Cancel
Save