tablesort_get_querystring() is not processing arrays in query string properly

remi - February 10, 2006 - 18:49
Project:Drupal
Version:4.7.0
Component:base system
Category:bug report
Priority:normal
Assigned:remi
Status:closed
Description

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

AttachmentSizeStatusTest resultOperations
tablesort-remi-1.diff1.44 KBIgnoredNoneNone

#1

markus_petrux - February 10, 2006 - 18:56

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

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

#2

remi - February 10, 2006 - 21:15

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.

#3

markus_petrux - February 11, 2006 - 07:41
Status:needs review» 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.

#4

moshe weitzman - February 12, 2006 - 01:27

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

#5

rkerr - February 13, 2006 - 03:10
Status: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.

#6

markus_petrux - February 13, 2006 - 03:29

>> 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

#7

moshe weitzman - May 3, 2006 - 16:24
Version:4.7.0-beta4» 4.7.0
Status:needs work» fixed

this got fixed finally during drupal_get_destination fix

#8

Anonymous - May 17, 2006 - 16:30
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.