In Drupal 4.6.5, tablesort_get_querystring() treats "virtual" arrays in the request string (either GET or POST) as a query string. The code for that function didn't change for Drupal 4.7.0, so it has the same problem.

For example, if my query string is like the following:

?colors[red]=f00&colors[green]=0f0&colors[blue]=00f&prefered=blue

Once processed by the current tablesort_get_querystring(), it will return this:

?colors=Array&prefered=blue

The patch attached to this post corrects tablesort_get_querystring() with a helper function _tablesort_get_querystring().

CommentFileSizeAuthor
tablesort-remi-1.diff1.44 KBremi

Comments

markus_petrux’s picture

Is this the same issue reported here?
http://drupal.org/node/48258

I would say dup, but your giving a patch here.

remi’s picture

I searched before posting. Honest!

Anyway, thanks for pointing that out. I've been running Drupal all day with that patch today and haven't encountered a problem yet.

markus_petrux’s picture

Status: Needs review » Closed (duplicate)

remi: your patch is quite interesting and it may help to build the new querystring more correctly (ie. dealing with arrays passed via POST), however the main problem seems to be have been indirectly addressed (see 48258).

Please, let me mark this a dup now. We can continue discussion on the other issue, if anything else needs to be done.

moshe weitzman’s picture

i think the main issue for this bug is http://drupal.org/node/48834.

rkerr’s picture

Status: Closed (duplicate) » Needs work

(Reopening, since Moshe has marked the other issue as a dupe of this one)

I would suggest some minor reformatting of the patch to match Drupal's coding guidelines
http://drupal.org/node/318

Also, I would think you should use is_array() instead of gettype() == 'array' to decide variable types. And instead of nesting an else { if { } } you could probably switch it to an elseif.

Otherwise, seems like it should fix the problem.

markus_petrux’s picture

>> since Moshe has marked the other issue as a dupe of this one
Nope. Not a dup of this one, but a dup of:
http://drupal.org/node/5371

moshe weitzman’s picture

Version: 4.7.0-beta4 » 4.7.0
Status: Needs work » Fixed

this got fixed finally during drupal_get_destination fix

Anonymous’s picture

Status: Fixed » Closed (fixed)