Open abc-design opened 3 years ago
I also got the same errors. In my case it occurs on a website with only one language (multi domain system), but I don’t know if this is the cause (another single language site works without the errors). I fixed it by editing Classes/Middleware/RedirectuionMiddleware.php, line 67: Instead of $method = $site->getConfiguration()['SiteLanguageRedirectionMethod'] ?? self::REDIRECT_METHOD_BROWSER;
Use this:
if (method_exists($this,'getConfiguration')) { $method = $site->getConfiguration()['SiteLanguageRedirectionMethod'] ?? self::REDIRECT_METHOD_BROWSER; }
An line 322:
if (is_object($requestLanguage)) {
if (
strpos($refererUri->getPath(), $requestLanguage->getBase()->getPath()) === false ||
strpos($refererUri->getPath(), $requestLanguage->getBase()->getPath()) !== 0 ||
($requestLanguage->getBase()->getPath() === '/' && !in_array($requestLanguage->getBase()->getPath(), $siteLanguageBasePaths))
) {
$response = $response->withAddedHeader('Set-Cookie', $cookieName . '=' . $requestLanguage->getLanguageId() . '; Path=/; Max-Age=' . (60*60*24*30));
}
}
Maybe this condition could get into the next version of the extension?
I'm getting a lot of TYPO3 Exceptions of this kind:
Uncaught TYPO3 Exception: Call to undefined method TYPO3\CMS\Core\Site\Entity\NullSite::getConfiguration() | Error thrown in file xxx/typo3conf/ext/site_language_redirection/Classes/Middleware/RedirectionMiddleware.php in line 67
Uncaught TYPO3 Exception: Call to a member function getBase() on null | Error thrown in file xxx/typo3conf/ext/site_language_redirection/Classes/Middleware/RedirectionMiddleware.php in line 306.
The site configuration is correct and the extension seems to work fine. But it's quite disturbing to get hundreds of these exceptions.