From: Tim Düsterhus Date: Thu, 15 Sep 2022 10:33:33 +0000 (+0200) Subject: Add safety check to PackageInstallationNodeBuilder to detect corrupted installation... X-Git-Tag: 5.5.5_dev_1~6^2^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0c10c79979df18c488f7a266a3cc17b77ae775f8;p=GitHub%2FWoltLab%2FWCF.git Add safety check to PackageInstallationNodeBuilder to detect corrupted installation plans --- diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php index 91a9f30633..589831f0e8 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php @@ -598,6 +598,13 @@ class PackageInstallationNodeBuilder $this->emptyNode = true; $instructions = ($this->installation->getAction() == 'install') ? $this->installation->getArchive()->getInstallInstructions() : $this->installation->getArchive()->getUpdateInstructions(); $count = \count($instructions); + + if ($count === 0) { + // Abort if an empty list of instructions is received. This most likely indicates that + // the update instructions have been erroneously discarded. + throw new \Exception('Received an empty list of instructions.'); + } + $i = 0; foreach ($instructions as $pip) { $i++;