[BUGIFX] Fix Redirect after switch-to-user 97/27897/3
authorHelmut Hummel <helmut.hummel@typo3.org>
Thu, 27 Feb 2014 13:18:14 +0000 (14:18 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Thu, 27 Feb 2014 14:02:12 +0000 (15:02 +0100)
The compatibility layer introduced in #55809
causes trouble with the user switch feature.

User switch intentionally redirects to index.php
but the compatibility layer kicks in and redirects
back to the user module, finally leading to an
endless redirect.

This can be resolved by checking for modules which
have been changed and need that compatibility layer.

Resolves: #56364
Releases: 6.2
Change-Id: I74d8c57335af66068383b49dc7d43ea480e631b8
Reviewed-on: https://review.typo3.org/27897
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
Reviewed-by: Oliver Hader
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/index.php

index 0b78367..65c9c6c 100644 (file)
@@ -43,13 +43,17 @@ if (!empty($_SERVER['HTTP_REFERER'])) {
        $typo3RequestDir = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_DIR');
        if (strpos($_SERVER['HTTP_REFERER'], $typo3RequestDir . 'mod.php') === 0) {
                parse_str(substr($_SERVER['HTTP_REFERER'], strpos($_SERVER['HTTP_REFERER'], '?') + 1), $referrerParameters);
-               \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
-                       'Module ' . $referrerParameters['M'] . ' called index.php. This is deprecated since TYPO3 6.2, use' .
-                       ' BackendUtility::getModuleUrl() instead to get the target for your call.'
-               );
-               parse_str($_SERVER['QUERY_STRING'], $queryParameters);
-               header('Location: ' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl($referrerParameters['M'], $queryParameters, FALSE, TRUE));
-               exit;
+               // As of now, only web_info and web_func have been converted and need the compatibility layer
+               if (!empty($referrerParameters['M']) && in_array($referrerParameters['M'], array('web_info', 'web_func'), TRUE)) {
+                       \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
+                               'Module ' . $referrerParameters['M'] . ' called index.php. This is deprecated since TYPO3 6.2, use' .
+                               ' BackendUtility::getModuleUrl() instead to get the target for your call.'
+                       );
+                       parse_str($_SERVER['QUERY_STRING'], $queryParameters);
+                       header('Location: ' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl($referrerParameters['M'], $queryParameters, FALSE, TRUE));
+                       exit;
+               }
+               unset($referrerParameters);
        }
        unset($typo3RequestDir);
 }