From 64684145d7a1f8d8835f09344fe0293f4e0f1246 Mon Sep 17 00:00:00 2001
From: Nicole Cordes <typo3@cordes.co>
Date: Mon, 2 Mar 2015 11:05:16 +0100
Subject: [PATCH] [BUGFIX] Prevent redirection loop for shortcuts
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch prevents the redirection to another page if the returned
URL is empty which would trigger a redirection loop.

Releases: master, 6.2
Resolves: #65447
Change-Id: Ida0fc65c83d32ca7ae45db2d02b87d7eb0c8d345
Reviewed-on: http://review.typo3.org/37446
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
---
 .../Classes/Controller/TypoScriptFrontendController.php    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
index 0ae349d789da..cf5b6ccdd907 100644
--- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
+++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
@@ -2952,8 +2952,11 @@ class TypoScriptFrontendController {
 		}
 		$redirectUrl = $cObj->typoLink_URL(array('parameter' => $parameter));
 
-		// redirect and exit
-		HttpUtility::redirect($redirectUrl, HttpUtility::HTTP_STATUS_307);
+		// Prevent redirection loop
+		if (!empty($redirectUrl)) {
+			// redirect and exit
+			HttpUtility::redirect($redirectUrl, HttpUtility::HTTP_STATUS_307);
+		}
 	}
 
 	/********************************************
-- 
GitLab