From c5185d6f7c7a4b6cfb815ded6ed6d8c926cc01cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 29 Sep 2023 16:10:16 +0200 Subject: [PATCH] Correctly handle `null` license data in LicensePage see 9f79c831c9bb9b5da9a718e42a5fc43aed4037a6 --- .../files/lib/acp/page/LicensePage.class.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/page/LicensePage.class.php b/wcfsetup/install/files/lib/acp/page/LicensePage.class.php index 74ca898fc6..b7020d050e 100644 --- a/wcfsetup/install/files/lib/acp/page/LicensePage.class.php +++ b/wcfsetup/install/files/lib/acp/page/LicensePage.class.php @@ -64,15 +64,15 @@ final class LicensePage extends AbstractPage $licenseApi = new LicenseApi(); try { - $this->licenseData = $licenseApi->readFromFile(); + $licenseData = $licenseApi->readFromFile(); if ( - $this->licenseData === null + $licenseData === null // Cache valid license data for 2 minutes. - || $this->licenseData->creationDate->getTimestamp() < (\TIME_NOW - 2 * 60) + || $licenseData->creationDate->getTimestamp() < (\TIME_NOW - 2 * 60) ) { - $this->licenseData = $licenseApi->fetchFromRemote(); - $licenseApi->updateLicenseFile($this->licenseData); + $licenseData = $licenseApi->fetchFromRemote(); + $licenseApi->updateLicenseFile($licenseData); } } catch (ParsingFailed $e) { if (\ENABLE_DEBUG_MODE && \ENABLE_DEVELOPER_TOOLS) { @@ -82,11 +82,13 @@ final class LicensePage extends AbstractPage throw new NamedUserException(WCF::getLanguage()->getDynamicVariable( 'wcf.acp.license.error.parsingFailed', [ - 'licenseData' => $this->licenseData, + 'licenseData' => $licenseData, ] )); } + $this->licenseData = $licenseData; + $identifiers = \array_merge( \array_keys($this->licenseData->woltlab), \array_keys($this->licenseData->pluginstore) -- 2.20.1