From: Alexander Ebert Date: Mon, 6 Nov 2023 13:02:19 +0000 (+0100) Subject: Fix the handling of unknown packages X-Git-Tag: 6.0.3_dev_1~47^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4fc606adfba733adb12f9118a39a095a97502097;p=GitHub%2FWoltLab%2FWCF.git Fix the handling of unknown packages --- diff --git a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php index 894f6f182c..5d8b6f37f7 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php @@ -848,6 +848,10 @@ final class PackageUpdateDispatcher extends SingletonFactory $version = $this->getNewestPackageVersion($package); } + if ($version === null) { + throw new SystemException("Cannot find the package '" . $package . "'"); + } + // get versions $conditions = new PreparedStatementConditionBuilder(); $conditions->add('pu.package = ?', [$package]); @@ -867,7 +871,7 @@ final class PackageUpdateDispatcher extends SingletonFactory $versions = $statement->fetchAll(\PDO::FETCH_ASSOC); if (empty($versions)) { - throw new SystemException("Cannot find package '" . $package . "' in version '" . $version . "'"); + throw new SystemException("Cannot find the package '" . $package . "' in version '" . $version . "'"); } return $versions; @@ -876,7 +880,7 @@ final class PackageUpdateDispatcher extends SingletonFactory /** * Returns the newest available version of a package. */ - public function getNewestPackageVersion(string $package): string + public function getNewestPackageVersion(string $package): ?string { // get all versions $versions = [];