Incorrect sort order favored older versions
authorAlexander Ebert <ebert@woltlab.com>
Wed, 1 Apr 2020 12:30:09 +0000 (14:30 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 1 Apr 2020 12:30:09 +0000 (14:30 +0200)
wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php

index 9147d7eeeb56fe87c8b308281c85c613e5475998..3af4d7420de9a9f84878077bd0a91560cb6d8290 100644 (file)
@@ -187,7 +187,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction {
                        }
                }
                
-               // sort by the lowest version and return all other sources for the same package
+               // Sort by the highest version and return all other sources for the same package.
                $validPackageUpdateIDs = [];
                foreach ($possiblePackages as $identifier => $packageSources) {
                        if (count($packageSources) > 1) {
@@ -212,8 +212,9 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction {
                                        ];
                                }
                                
+                               // Sort packages with the highest version ending up on top.
                                uasort($packageVersions, function($a, $b) {
-                                       return Package::compareVersion($a['packageVersion'], $b['packageVersion']);
+                                       return Package::compareVersion($b['packageVersion'], $a['packageVersion']);
                                });
                                
                                reset($packageVersions);