Bug #17713
closedaddQueryString.exclude with an empty query string causes &= url parameter
0%
Description
and in combination with cHash you get broken links
in function getQueryArguments in class tslib_cObj:
with undefined method QUERY_STRING is exploded, so $q_in is an array with one empty element.
$q_out is an array with one empty element, too.
with
foreach ($q_out as $k => $v) {
$content .= '&'.$k.'='.$v;
}
$content will be &=
I've added a check if $k is not empty to solve it. Perhaps you have an better solution.
printlink TS to reproduce:
typolink.parameter.data = page:uid
typolink.parameter.wrap = |,98
typolink.addQueryString = 1
typolink.addQueryString.exclude = cHash
typolink.useCacheHash = 1
(issue imported from #M6576)
Files
Updated by Marc Bastian Heinrichs almost 17 years ago
sorry, a little bit tricky description. hope this is better:
- set up a clean t3 installation
- use following TS setup in the first page:
page = PAGE
page.10 = TEXT
page.10.value = HELLO WORLD!
page.10.typolink.parameter.data = page:uid
page.10.typolink.parameter.wrap = |,98
page.10.typolink.addQueryString = 1
page.10.typolink.addQueryString.exclude = cHash
page.10.typolink.useCacheHash = 1
- open the FE with clean cache and WITHOUT any url parameter (also no ?id= )
- you get an link to index.php?id=1&type=98&=&cHash=xyz
in combination with realurl I get a "cHash comparison failed" error
Updated by Marc Bastian Heinrichs almost 17 years ago
here is the patch against 4.1.4
Updated by Jörg Wagner over 16 years ago
The patch works, but is not optimal.
I append a patch (6576_B.patch) that attacks the real reason of this problem:
When building the $q_in array in function getQueryArguments, the servers QUERY_STRING is exploded using a '&' delimiter char.
If the QUERY_STRING is empty, the result of this is (as typical for PHP) an array with one empty string value instead of an empty array. This leads to a key value pair of "" => NULL in $q_in.
The added patch solves that wrong behaviour.
It would be great if this could be transmitted to trunk soon - it really kills website links whenever addQueryString.exclude is used!
Updated by Marc Bastian Heinrichs over 16 years ago
Hi Masi,
could you please fix this also in TYPO3_4-1?!
THX
Maba
Updated by Michael Stucki about 16 years ago
I propose a different solution which does not require the cHash parameter to be excluded explicitely, see attached patch.
It will also fix one more problem that linkVars and additionalParams are mixed when calculating the cHash value.
- michael