[BUGFIX] Correct typolink section for addQueryString=false 08/43608/8
authorAndreas Allacher <andreas.allacher@cyberhouse.at>
Mon, 28 Sep 2015 09:08:11 +0000 (11:08 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 29 Oct 2015 22:56:23 +0000 (23:56 +0100)
If addQueryString is false the query parameters should not
be taken into account. Only the parameters set in the
typolink need to be added before the section mark.

Change-Id: I6e40ff5b5c6135cd56fefd811c53af1e3980ed0f
Resolves: #70147
Releases: master
Reviewed-on: https://review.typo3.org/43608
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index fa42ad8..2c98ea6 100644 (file)
@@ -6663,16 +6663,19 @@ class ContentObjectRenderer
                     $targetPart = $LD['target'] ? ' target="' . htmlspecialchars($LD['target']) . '"' : '';
                     // If sectionMark is set, there is no baseURL AND the current page is the page the link is to, check if there are any additional parameters or addQueryString parameters and if not, drop the url.
                     if ($sectionMark && !$tsfe->config['config']['baseURL'] && $page['uid'] == $tsfe->id && !trim($addQueryParams) && !($conf['addQueryString'] && $conf['addQueryString.'])) {
-                        list(, $URLparams) = explode('?', $this->lastTypoLinkUrl);
-                        list($URLparams) = explode('#', $URLparams);
-                        parse_str($URLparams . $LD['orig_type'], $URLparamsArray);
-                        // Type nums must match as well as page ids
-                        if ((int)$URLparamsArray['type'] == $tsfe->type) {
-                            unset($URLparamsArray['id']);
-                            unset($URLparamsArray['type']);
-                            // If there are no parameters left.... set the new url.
-                            if (empty($URLparamsArray)) {
-                                $this->lastTypoLinkUrl = $sectionMark;
+                        $currentQueryParams = $this->getQueryArguments(array());
+                        if (!trim($currentQueryParams)) {
+                            list(, $URLparams) = explode('?', $this->lastTypoLinkUrl);
+                            list($URLparams) = explode('#', $URLparams);
+                            parse_str($URLparams . $LD['orig_type'], $URLparamsArray);
+                            // Type nums must match as well as page ids
+                            if ((int)$URLparamsArray['type'] == $tsfe->type) {
+                                unset($URLparamsArray['id']);
+                                unset($URLparamsArray['type']);
+                                // If there are no parameters left.... set the new url.
+                                if (empty($URLparamsArray)) {
+                                    $this->lastTypoLinkUrl = $sectionMark;
+                                }
                             }
                         }
                     }