WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#4878 closed defect (bug) (fixed)

add_query_args() mangles URLs with encoded arrays in them

Reported by: 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 8 years ago.
First try
4878.003.diff (2.5 KB) - added by markjaquith 8 years ago.
better logic

Download all attachments as: .zip

Change History (11)

comment:1 @ryan8 years ago

  • Description modified (diff)

@markjaquith8 years ago

First try

comment:2 @markjaquith8 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.

@markjaquith8 years ago

better logic

comment:3 @markjaquith8 years ago

003

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.

comment:4 @markjaquith8 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

comment:5 @markjaquith7 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.

comment:6 @markjaquith7 years ago

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

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

comment:7 @markjaquith7 years ago

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

comment:8 @markjaquith7 years ago

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

comment:9 @markjaquith7 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.