Bug #17713
closed
addQueryString.exclude with an empty query string causes &= url parameter
Added by Marc Bastian Heinrichs about 17 years ago.
Updated about 16 years ago.
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
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
here is the patch against 4.1.4
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!
Hi Masi,
could you please fix this also in TYPO3_4-1?!
THX
Maba
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
closed, as it is shipped in 4.2.1
Also available in: Atom
PDF