Closed j-lang closed 2 years ago
Cannot reproduce. I am using v2.1.1 on a client's site without any problems. Android devices are redirected just fine.
What exact PHP version are you running?
Version information:
TYPO3 9.5.11 PHP Version 7.2.10
I can confirm the same error in the logs - next to 404 error page fetch errors in the log. $userAgent = array_shift($userAgent);
L:343 does not make sure, that a string is returned if the $userAgent is a multidimensional array. Changing the return to return is_string($userAgent) && preg_match($this->botPattern, $userAgent);
maybe can solve the problem?
Thanks @Schweriner for the hint. Could you check if my PR solves the issue? https://github.com/urbantrout/site-language-redirection/pull/10
@urbantrout sorry I'm not able to test a redirect based on my browser settings - just had to fix this error. Someone else needs to test if the redirects still work.
Made patch in /Classes/Middleware/RedirectionMiddleware.php but get still error (1) of first post:
what is this android-app scheme? never heard of it. are you using this in a web app or native app or something?
Or a PWA?
Samsung Tab S5e or S10+ - Google Chrome, entering URL...
Could you send me the link to the test installation again. Via email ;)
We could reproduce the error with a Google Pixel 3, Android 11 when typing the domain name directly in the Google search field at the mobile's desktop. The error occurs only if mobile browser(!) language is same as site default language.
@marksh Thanks for the additional info. I will take a look into it…
Can someone check if this branch solves the problem?
https://github.com/urbantrout/site-language-redirection/tree/android-app-scheme
Great job, now it works!
Double checked with version 2.1.1 on repo, after updating of your last changes:
// Check if referrer is present and scheme is not
android-app. if ($normalizedParams->getHttpReferer() && substr($normalizedParams->getHttpReferer(), 0, 11) !== 'android-app') {
there is no error when loading.
After installation of site-language-redirection we noticed two errors:
Android devices are getting an error page, the corresponding error message in backend protocol is:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1436717338: Unsupported scheme "android-app"; must be any empty string or in the set (http, https) | InvalidArgumentException thrown in file /html/typo3/typo3_src-9.5.11/typo3/sysext/core/Classes/Http/Uri.php in line 641.
Another error message was fount in TYPO3 protocol but there is no further device/browser information in access.log:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: preg_match() expects parameter 2 to be string, array given | TypeError thrown in file /html/typo3/typo3conf/ext/site_language_redirection/Classes/Middleware/RedirectionMiddleware.php in line 346
Extensions is configured for: Browser language (HTTP headers)