Skip to content

Commit

Permalink
Merge pull request #151 from liayn/optional-tsfe
Browse files Browse the repository at this point in the history
[BUGFIX] Cope with missing TSFE
  • Loading branch information
xperseguers authored May 31, 2024
2 parents 0ff0574 + 235b013 commit 7c55057
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 7c55057

Please sign in to comment.