Added safe-guard against case-mismatches for package identifiers
authorAlexander Ebert <ebert@woltlab.com>
Tue, 15 Aug 2017 10:29:59 +0000 (12:29 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 15 Aug 2017 10:29:59 +0000 (12:29 +0200)
wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php

index 83d6e03a185e628cb1596d87dd2ee41f915b23d6..7aadaa913b99df5928c61900c2da3487c853f696 100644 (file)
@@ -622,6 +622,15 @@ class PackageUpdateDispatcher extends SingletonFactory {
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute($conditions->getParameters());
                while ($row = $statement->fetchArray()) {
+                       if (!isset($existingPackages[$row['package']])) {
+                               if (ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS) {
+                                       throw new SystemException("Invalid package update data, identifier '" . $row['package'] . "' does not match any installed package (case-mismatch).");
+                               }
+                               
+                               // case-mismatch, skip the update
+                               continue;
+                       }
+                       
                        // test version
                        foreach ($existingPackages[$row['package']] as $existingVersion) {
                                if (Package::compareVersion($existingVersion['packageVersion'], $row['packageVersion'], '<')) {