]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix comparison of PHP versions 25138/head
authorDamien Goutte-Gattat <dgouttegattat@incenp.org>
Thu, 14 Jan 2021 22:54:53 +0000 (22:54 +0000)
committerDamien Goutte-Gattat <dgouttegattat@incenp.org>
Thu, 14 Jan 2021 23:03:20 +0000 (23:03 +0000)
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>
lib/private/App/AppStore/Fetcher/AppFetcher.php

index 4dc517879e83b2590446d9b831ee47c02a83cecf..70bf2a37d9d5243c2c36d34f89305a0ce23acd18 100644 (file)
@@ -113,12 +113,12 @@ class AppFetcher extends Fetcher {
                                                        $phpVersion = $versionParser->getVersion($release['rawPhpVersionSpec']);
                                                        $minPhpVersion = $phpVersion->getMinimumVersion();
                                                        $maxPhpVersion = $phpVersion->getMaximumVersion();
-                                                       $minPhpFulfilled = $minPhpVersion === '' || $this->compareVersion->isCompatible(
+                                                       $minPhpFulfilled = $minPhpVersion === '' || version_compare(
                                                                        PHP_VERSION,
                                                                        $minPhpVersion,
                                                                        '>='
                                                                );
-                                                       $maxPhpFulfilled = $maxPhpVersion === '' || $this->compareVersion->isCompatible(
+                                                       $maxPhpFulfilled = $maxPhpVersion === '' || version_compare(
                                                                        PHP_VERSION,
                                                                        $maxPhpVersion,
                                                                        '<='