[BUGFIX] Bind the cHash to the id of the "real" page 84/50184/4
authorHelmut Hummel <info@helhum.io>
Tue, 11 Oct 2016 13:05:17 +0000 (15:05 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 12 Nov 2016 23:45:19 +0000 (00:45 +0100)
If a link to a mount point or a shortcut is created,
the id argument in the url points to the id of the real page,
where the mount or the shortcut points to.

This is why we need to take the id of the final page
to be hashed and not the one used to generate the link.

We also need to move cHash calculation below shortcut resolving.

Resolves: #78238
Releases: master, 7.6, 6.2
Change-Id: I96c4305c6d769a5851c17d6fdcba3cd7584fc3ec
Reviewed-on: https://review.typo3.org/50184
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index 608b87d..87d2342 100644 (file)
@@ -5931,16 +5931,6 @@ class ContentObjectRenderer
                     if ($addQueryParams === '&' || $addQueryParams[0] !== '&') {
                         $addQueryParams = '';
                     }
-                    if ($conf['useCacheHash']) {
-                        $params = $tsfe->linkVars . $addQueryParams . '&id=' . $linkDetails['pageuid'];
-                        if (trim($params, '& ') != '') {
-                            /** @var $cacheHash CacheHashCalculator */
-                            $cacheHash = GeneralUtility::makeInstance(CacheHashCalculator::class);
-                            $cHash = $cacheHash->generateForParameters($params);
-                            $addQueryParams .= $cHash ? '&cHash=' . $cHash : '';
-                        }
-                        unset($params);
-                    }
                     $targetDomain = '';
                     $currentDomain = (string)$this->getEnvironmentVariable('HTTP_HOST');
                     // Mount pages are always local and never link to another domain
@@ -5982,6 +5972,16 @@ class ContentObjectRenderer
                             $targetDomain = '';
                         }
                     }
+                    if ($conf['useCacheHash']) {
+                        $params = $tsfe->linkVars . $addQueryParams . '&id=' . $page['uid'];
+                        if (trim($params, '& ') != '') {
+                            /** @var $cacheHash CacheHashCalculator */
+                            $cacheHash = GeneralUtility::makeInstance(CacheHashCalculator::class);
+                            $cHash = $cacheHash->generateForParameters($params);
+                            $addQueryParams .= $cHash ? '&cHash=' . $cHash : '';
+                        }
+                        unset($params);
+                    }
                     $absoluteUrlScheme = 'http';
                     // URL shall be absolute:
                     if (isset($conf['forceAbsoluteUrl']) && $conf['forceAbsoluteUrl'] || $page['url_scheme'] > 0) {