Skip to content

Commit

Permalink
[BUGFIX] Cope with missing TSFE
Browse files Browse the repository at this point in the history
If for some reason TSFE is not available, use "en" as fallback language.

Resolves: #138
  • Loading branch information
liayn committed May 3, 2024
1 parent eec5a91 commit 235b013
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Classes/Service/OAuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 235b013

Please sign in to comment.