[FEATURE] Generate cHash only if needed
authorPopy <popy.dev@gmail.com>
Thu, 21 Jul 2011 15:04:02 +0000 (17:04 +0200)
committerXavier Perseguers <xavier@typo3.org>
Mon, 10 Oct 2011 10:14:13 +0000 (12:14 +0200)
tslib_cObj->typolink() generates cHash in every case, even if not
needed. Change the behavior to generate cHash only if necessary.

Change-Id: Id6a015e6bd89e9baeafd9532d4a21018adf91691
Resolves: #28352
Releases: 4.6
Reviewed-on: http://review.typo3.org/3456
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
Tested-by: Popy
Reviewed-by: Xavier Perseguers
Reviewed-by: Stefan Neufeind
Reviewed-by: Benjamin Mack
Reviewed-by: Björn Pedersen
Tested-by: Xavier Perseguers
typo3/sysext/cms/tslib/class.tslib_content.php

index ed71890..90afe9e 100644 (file)
@@ -5687,7 +5687,11 @@ class tslib_cObj {
                                                                // Mind the order below! See http://bugs.typo3.org/view.php?id=5117
                                                        $params = $GLOBALS['TSFE']->linkVars . $addQueryParams;
                                                        if (trim($params, '& ') != '') {
-                                                               $addQueryParams .= '&cHash=' . t3lib_div::generateCHash($params);
+                                                               $cHashParams = t3lib_div::cHashParams($addQueryParams);
+                                                               if (count($cHashParams) > 1) {
+                                                                       $addQueryParams .= '&cHash=' . t3lib_div::calculateCHash($cHashParams);
+                                                               }
+                                                               unset($cHashParams);
                                                        }
                                                        unset($params);
                                                }