From 235b013a5e92da25127e0c44ba67d8da0e0b30b3 Mon Sep 17 00:00:00 2001 From: Markus Klein Date: Fri, 3 May 2024 14:13:57 +0200 Subject: [PATCH] [BUGFIX] Cope with missing TSFE If for some reason TSFE is not available, use "en" as fallback language. Resolves: #138 --- Classes/Service/OAuthService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/Service/OAuthService.php b/Classes/Service/OAuthService.php index f77a310..ad163f4 100644 --- a/Classes/Service/OAuthService.php +++ b/Classes/Service/OAuthService.php @@ -68,7 +68,7 @@ public function getAuthorizationUrl(array $options = []): string if (!empty($this->settings['oidcAuthorizeLanguageParameter'])) { $languageOption = $this->settings['oidcAuthorizeLanguageParameter']; if (!empty($languageOption)) { - $language = $this->getTSFE()->getLanguage()->getTwoLetterIsoCode(); + $language = $this->getTSFE() ? $this->getTSFE()->getLanguage()->getTwoLetterIsoCode() : 'en'; $options[$languageOption] = $language; } } @@ -271,8 +271,8 @@ protected function getRedirectUrl(): string return $this->settings['oidcRedirectUri'] ?: GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); } - protected function getTSFE(): TypoScriptFrontendController + protected function getTSFE(): ? TypoScriptFrontendController { - return $GLOBALS['TSFE']; + return $GLOBALS['TSFE'] ?? null; } }