[TASK] Use $tsfe->type for generating the redirect URL 87/58087/3
authorBenni Mack <benni@typo3.org>
Thu, 30 Aug 2018 13:22:22 +0000 (15:22 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Thu, 30 Aug 2018 17:09:22 +0000 (19:09 +0200)
At the point where TSFE creates a Redirect URL for shortcuts,
$type should be used from the normalized $tsfe->type property
and not from the GET variable directly, as this could have been modified
by a hook already.

Resolves: #86040
Releases: master
Change-Id: I87503570ca257d10ebca3a9056213ae5a5354764
Reviewed-on: https://review.typo3.org/58087
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Daniel Sattler <sattler@b13.de>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index a473cb9..88c1515 100644 (file)
@@ -3141,25 +3141,22 @@ class TypoScriptFrontendController implements LoggerAwareInterface
     }
 
     /**
+     * Instantiate \TYPO3\CMS\Frontend\ContentObject to generate the correct target URL
+     *
      * @return string
      */
     protected function getUriToCurrentPageForRedirect(): string
     {
         $this->calculateLinkVars();
-        // Instantiate \TYPO3\CMS\Frontend\ContentObject to generate the correct target URL
-        /** @var $cObj ContentObjectRenderer */
-        $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class, $this);
         $parameter = $this->page['uid'];
-        $type = GeneralUtility::_GET('type');
-        if ($type && MathUtility::canBeInterpretedAsInteger($type)) {
-            $parameter .= ',' . $type;
+        if ($this->type && MathUtility::canBeInterpretedAsInteger($this->type)) {
+            $parameter .= ',' . $this->type;
         }
-        $redirectUrl = $cObj->typoLink_URL([
+        return GeneralUtility::makeInstance(ContentObjectRenderer::class, $this)->typoLink_URL([
             'parameter' => $parameter,
             'addQueryString' => true,
             'addQueryString.' => ['exclude' => 'id']
         ]);
-        return $redirectUrl;
     }
 
     /********************************************