diff --git a/wcfsetup/install/files/lib/system/acp/dashboard/box/ExpiringLicensesAcpDashboardBox.class.php b/wcfsetup/install/files/lib/system/acp/dashboard/box/ExpiringLicensesAcpDashboardBox.class.php index 0f69f5c7e7d..c5b63cf39bc 100644 --- a/wcfsetup/install/files/lib/system/acp/dashboard/box/ExpiringLicensesAcpDashboardBox.class.php +++ b/wcfsetup/install/files/lib/system/acp/dashboard/box/ExpiringLicensesAcpDashboardBox.class.php @@ -19,6 +19,7 @@ final class ExpiringLicensesAcpDashboardBox extends AbstractAcpDashboardBox { private ?LicenseData $licenseData; private array $expiredLicenses; + private bool $fetchLicenseDataFailed = false; #[\Override] public function isAccessible(): bool @@ -29,7 +30,7 @@ public function isAccessible(): bool #[\Override] public function hasContent(): bool { - return $this->getExpiredLicenses() !== []; + return $this->getExpiredLicenses() !== [] || $this->fetchLicenseDataFailed; } private function getExpiredLicenses(): array @@ -61,7 +62,13 @@ private function getLicenseData(): ?LicenseData { if (!isset($this->licenseData)) { $licenseApi = new LicenseApi(); - $this->licenseData = $licenseApi->getUpToDateLicenseData(); + + try { + $this->licenseData = $licenseApi->getUpToDateLicenseData(); + } catch (\Throwable) { + $this->licenseData = null; + $this->fetchLicenseDataFailed = true; + } } return $this->licenseData; @@ -76,6 +83,15 @@ public function getTitle(): string #[\Override] public function getContent(): string { + if ($this->fetchLicenseDataFailed) { + return \sprintf( + '%s', + WCF::getLanguage()->getDynamicVariable('wcf.acp.license.error.parsingFailed', [ + 'licenseData' => null, + ]) + ); + } + $packages = []; foreach (\array_keys($this->getExpiredLicenses()) as $packageName) { $packages[$packageName] = PackageCache::getInstance()->getPackageByIdentifier($packageName);