Fix comparison of PHP versions
Use the builtin function `version_compare` to check an app's compatibility with the available PHP version, instead of reusing the `OC\App\CompareVersion::isCompatible` method which is intended to compare Nextcloud versions. PHP version strings do not always necessarily follow the simple Major.Minor.Patch format used by Nextcloud and therefore cannot be properly compared by that method. Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
This commit is contained in:
parent
ac14e42b49
commit
151abca91c
|
@ -113,12 +113,12 @@ class AppFetcher extends Fetcher {
|
||||||
$phpVersion = $versionParser->getVersion($release['rawPhpVersionSpec']);
|
$phpVersion = $versionParser->getVersion($release['rawPhpVersionSpec']);
|
||||||
$minPhpVersion = $phpVersion->getMinimumVersion();
|
$minPhpVersion = $phpVersion->getMinimumVersion();
|
||||||
$maxPhpVersion = $phpVersion->getMaximumVersion();
|
$maxPhpVersion = $phpVersion->getMaximumVersion();
|
||||||
$minPhpFulfilled = $minPhpVersion === '' || $this->compareVersion->isCompatible(
|
$minPhpFulfilled = $minPhpVersion === '' || version_compare(
|
||||||
PHP_VERSION,
|
PHP_VERSION,
|
||||||
$minPhpVersion,
|
$minPhpVersion,
|
||||||
'>='
|
'>='
|
||||||
);
|
);
|
||||||
$maxPhpFulfilled = $maxPhpVersion === '' || $this->compareVersion->isCompatible(
|
$maxPhpFulfilled = $maxPhpVersion === '' || version_compare(
|
||||||
PHP_VERSION,
|
PHP_VERSION,
|
||||||
$maxPhpVersion,
|
$maxPhpVersion,
|
||||||
'<='
|
'<='
|
||||||
|
|
Loading…
Reference in New Issue