Incorrect update path calculation if the only available version is not an exact match
authorAlexander Ebert <ebert@woltlab.com>
Thu, 30 Jan 2020 16:37:24 +0000 (17:37 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 30 Jan 2020 16:37:24 +0000 (17:37 +0100)
wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php

index ce8b10060c650dde32470b1a23f555ffbc83bb0c..7bb81aa33cdd61ede692150e27073efeb49fec56 100644 (file)
@@ -478,13 +478,20 @@ class PackageInstallationScheduler {
                        ]);
                        $packageVersions = $statement->fetchAll(\PDO::FETCH_COLUMN);
                        
-                       if (count($packageVersions) > 1) {
+                       $count = count($packageVersions);
+                       if ($count > 1) {
                                // sort by version number
                                usort($packageVersions, [Package::class, 'compareVersion']);
                                
                                // get highest version
                                $version = array_pop($packageVersions);
                        }
+                       else if ($count === 1 && $version !== $packageVersions[0]) {
+                               // This may happen if there is a compatible but newer version of the required
+                               // version, that also happens to be the only available version. For example,
+                               // "5.2.0" is requested but there is only "5.2.0 pl 1".
+                               $version = $packageVersions[0];
+                       }
                }
                
                // get all fromversion