Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#4878 closed defect (bug) (fixed)

add_query_args() mangles URLs with encoded arrays in them

Reported by: ryan's profile ryan Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.3
Component: General Keywords:
Focuses: Cc:

Description (last modified by ryan)

?cats%5B%5D=3 is changed to ?cats=Array. This breaks paging links and canonical redirects for these URLs.

Attachments (2)

4878.001.diff (763 bytes) - added by markjaquith 17 years ago.
First try
4878.003.diff (2.5 KB) - added by markjaquith 17 years ago.
better logic

Download all attachments as: .zip

Change History (11)

#1 @ryan
17 years ago

  • Description modified (diff)

17 years ago

First try

#2 @markjaquith
17 years ago

Need to pass '&' as separator, but our PHP4 compat function doesn't respect that. I've not found a suitable replacement function. The one in PEAR is no good.

17 years ago

better logic

#3 @markjaquith
17 years ago


Upgrades our http_build_query() compat function, which has been renamed to _http_build_query() with a pass-through for compat. Because early PHP5 versions don't accept the separator param, we could get wacky results if it is set in php.ini, so unless it is '&' in php.ini, we use our own version.

I haven't thoroughly tested this... but just wanted to throw it out there before I retired for the night.

#4 @markjaquith
17 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5999]) Preserve query string arrays in add_query_arg(). fixes #4878 for trunk

#5 @markjaquith
17 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This broke some things in the admin where an & delimited query string was being passed to add_query_arg()

Proposed solution is converting & to & in add_query_arg()

We should be deprecating the passing of & to these functions.

#6 @markjaquith
17 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [6005]) Turn & to & in add_query_arg(). fixes #4878

#7 @markjaquith
17 years ago

(In [6064]) Only urlencode previously existing values in add_query_arg() (more backwards compatible). fixes #4935. see #4084. see #4878

#8 @markjaquith
17 years ago

(In [6069]) Forgot to use $lsb and $rsb in [6064]. Props mdawaffe. see #4935. see #4878

#9 @markjaquith
17 years ago

(In [6070]) Actually, we always need to URLencode square brackets... or wp_redirect() will strip them out. see #4935. see #4878

Note: See TracTickets for help on using tickets.