-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
workaround to debian php version that does not use semver #142
Conversation
|
It does, but the value passed to |
I do not have to understand why Debian only breaks ONE of the potential version identifiers but inconsistently does not touch the others I presume. Interesting approach. I'm inclined to merge it, but am wondering how RC builds are going to be affected with this modification? Will it drop it or does the the |
I see. If PHP_RELEASE_VERSION does not contains the rc-suffix this patch would break requirements that depends on it. Don't know the answer, will verify tomorrow with a docker container. |
According to http://php.net/manual/en/reserved.constants.php the
The example from documentation is So, as far I can understand, PHP is not using semantic versioning officially. I search for a document or information but nothing. The closest to a standard is the documentation of If PHP is not following SemVer then asserting that PHP encourage you to ensure that PHP also establish that comparing PHP versions should follow this specification from So, instead of the current concatenation strategy I would like to propose that try to create the // ...
case $requirement instanceof PhpVersionRequirement: {
$php = $requirement->getVersionConstraint();
try {
$phpversion = new Version(PHP_VERSION);
} catch (InvalidVersionException $ex) {
$phpversion = new Version(PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION);
}
if (!$php->complies($phpversion)) {
$issues[] = sprintf(
'PHP Version %s required, but %s in use',
$php,
PHP_VERSION
);
}
continue 2;
}
// ... Other different change would be to create the class |
After quick confirmation from @SaraMG PHP does not follow SemVer. I'm changing my PR to this:
|
I'll merge this for now as a workaround. In the longer run, this should be replaced by a dedicated PHPVersion class that is "relaxed" in terms of semver compliance. As that needs an updated version of phar-io/version, that'll come later. |
Debian is using a version that is breaking SemVer (example
7.0.29-1
)This is on
PHP_VERSION
constant, but as workaround the php version can be built from constantsPHP_MAJOR_VERSION
,PHP_MINOR_VERSION
&PHP_RELEASE_VERSION
This PR uses this concatenation strategy on
PharIo\Phive\CompatibilityService::canRun
and\PharIo\Phive\Environment::getRuntimeVersion
.This would also fix #136
Related: phar-io/version#10