How to reproduce:
* Configure term paths like "browse?f[0]=category:[tid]"
* Have a term view listing linked terms
Before core update, good:
* Link is like "example.com/browse?f%5B0%5D=category%3a123"
After core update, bad (note double encoding):
* Link is like "example.com/browse?f%255B0%255D=category%3a123"
How to fix:
* (proposed:) #2909714: drupal_get_query_array() does not urldecode query names
* Alternatively, make some ugly workarounds here
Background: In \views_handler_field::render_as_link a query is first built then parsed. Since 7.55 special characters are encoded, but not back decoded, so in the absence of tokens this is not an identity transformation anymore.
// If the query and fragment were programatically assigned overwrite any
// parsed values.
if (isset($alter['query'])) {
// Convert the query to a string, perform token replacement, and then
// convert back to an array form for l().
$options['query'] = drupal_http_build_query($alter['query']);
$options['query'] = strtr($options['query'], $tokens);
$options['query'] = drupal_get_query_array($options['query']);
}
Note: First i thought i can reproduce this with any linked text field, but i did not manage to.
Comment | File | Size | Author |
---|---|---|---|
#7 | 2909709-7.patch | 863 bytes | David_Rothstein |
Comments
Comment #2
geek-merlinComment #3
geek-merlinComment #4
joseph.olstadGreat work @axel.rutz I recommend the core fix
#2909714-3: drupal_get_query_array() does not urldecode query names
Comment #5
joseph.olstadpostponing this on the core fix.
Comment #6
geek-merlinGreat you reviewed and RTBC'd it!
Comment #7
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedLooks like you can trigger this before Drupal 7.55 also, if the query string is something with special characters in it, such as
?*key*=[value]
- but clearly it's worse with Drupal 7.55 and higher.The fix in core is presumably the best fix, but Views could also fix this on its own if it wants, I think? (See attached.) I don't see much reason for Views to use Drupal-specific API functions here anyway when the PHP ones will do fine (the encoding is being undone right away so the difference between urlencode() vs rawurlencode() doesn't seem like it should matter).
Comment #8
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commented