Bug #88101

f:uri.action (and f:link.action)’s argumentsToBeExcludedFromQueryString argument mis-handles comma (,) in argument names

Added by Sven-S. Porst almost 3 years ago. Updated 15 days ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2019-04-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

f:uri.action’s argumentsToBeExcludedFromQueryString argument should remove existing parameters. This does not work reliably when the paramter name contains a , (comma).

Example template:

<p>
Include this in a template, view its page. Then
add these parameters to the URI in the browser:
&a[foo][x]=1&a[foo][y]=1&a[foo,bar][x]=1&a[foo,bar][y]=1
</p>

<p>
<f:uri.action
addQueryString="TRUE"
argumentsToBeExcludedFromQueryString="{0:'a[foo][x]'}"
noCacheHash="1"
/>
– should remove a[foo] only: works as expected
</p>

<p>
<f:uri.action
addQueryString="TRUE"
argumentsToBeExcludedFromQueryString="{0:'a[foo,bar][x]'}"
noCacheHash="1"
/>
– should remove a[foo,bar][x] only: does not work as expected
</p>

<p>
<f:uri.action
addQueryString="TRUE"
argumentsToBeExcludedFromQueryString="{0:'a[foo%2Cbar][x]'}"
noCacheHash="1"
/>
– removes a[foo,bar][x] only
</p>

Looking at the code suggests that, internally, TYPO3 explodes/implodes this parameter using , as the separator, which looks like it could be the cause of this issue.

Seen in TYPO3 9.5.5 as well as TYPO3 8.7.

#1

Updated by Claus Due almost 2 years ago

  • Category changed from Fluid to Link Handling, Site Handling & Routing
  • Status changed from New to Needs Feedback

I'm not sure which is the correct format to use for "argumentsToBeExcludedFromQueryString" - whether or not comma separating the sub-properties is even supposed to be supported.

Fluid uses Extbase's UriBuilder to create the link and UriBuilder uses typoLink to create it in frontend. Here is what you find in UriBuilder:

$typolinkConfiguration['addQueryString.'] = [
'exclude' => implode(',', $this->argumentsToBeExcludedFromQueryString)
];

This would imply that comma separation is not supported in the way described in this issue:

  • TypoLink expects a comma-separated list of arguments to be excluded
  • But using a comma in this sub-property would cause the string to be split incorrectly in TypoLink
  • Which would cause the arguments to not be detected and would not cause them to be excluded

For all I can see it looks like this issue might be a misunderstanding of the CSV support in "addQueryString.exclude" of TypoLink. It does not appear to be constructed in a way that allows sub-properties to be CSV, it would only work for root-level properties.

Set to "needs feedback" and moved to "Link Handling & Routing" category for further evaluation, but I suspect the answer is "unsupported usage".

#2

Updated by Benni Mack 15 days ago

  • Status changed from Needs Feedback to Closed

Yup. commas are not supported at all with Typolink unfortunately.

Also available in: Atom PDF