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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

axel.rutz created an issue. See original summary.

geek-merlin’s picture

Issue summary: View changes
geek-merlin’s picture

Issue summary: View changes
joseph.olstad’s picture

Great work @axel.rutz I recommend the core fix
#2909714-3: drupal_get_query_array() does not urldecode query names

joseph.olstad’s picture

Status: Active » Postponed

postponing this on the core fix.

geek-merlin’s picture

Great you reviewed and RTBC'd it!

David_Rothstein’s picture

Title: Complex entityuri broken since core 7.55 » Links to entity URIs with special characters are broken, especially since Drupal core 7.55
Version: 7.x-3.18 » 7.x-3.x-dev
Status: Postponed » Needs review
FileSize
863 bytes

Looks 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).

David_Rothstein’s picture

Title: Links to entity URIs with special characters are broken, especially since Drupal core 7.55 » Links to entity URIs with special characters in query parameter names are broken, especially since Drupal core 7.55