I noticed there is a function called
drupal_get_query_array() in common.inc, this function seems to do exactly what the core PHP function
parse_str() does, except parse_str does it in c code, and can handle arrays in the query string.
It seems the function was introduced in
I had a look through that issue, and it seems that
parse_str() may not have been known to people involved in that issue.
I'm wondering first, if there is any reason this function cannot be replaced with parse_str(), and if not, then the patches attached in the next comment should work for D7 and D8.
PASSED: [[SimpleTest]]: [MySQL] 36,647 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-get-query-array-to-parse-str-D7-1597784-1.patch. Unable to apply patch. See the log in the details link for more information. View