Ticket #4878 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

add_query_args() mangles URLs with encoded arrays in them

Reported by: ryan Assigned to: anonymous
Priority: normal Milestone: 2.3
Component: General Version: 2.3
Severity: normal Keywords:
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

4878.001.diff (0.7 kB) - added by markjaquith on 08/30/07 22:24:07.
First try
4878.003.diff (2.5 kB) - added by markjaquith on 08/31/07 02:59:48.
better logic

Change History

08/30/07 22:22:27 changed by ryan

  • description changed.

08/30/07 22:24:07 changed by markjaquith

  • attachment 4878.001.diff added.

First try

08/30/07 23:32:06 changed by markjaquith

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.

08/31/07 02:59:48 changed by markjaquith

  • attachment 4878.003.diff added.

better logic

08/31/07 03:01:48 changed by markjaquith

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.

09/01/07 03:41:50 changed by markjaquith

  • status changed from new to closed.
  • resolution set to fixed.

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

09/01/07 22:11:26 changed by markjaquith

  • status changed from closed to reopened.
  • resolution deleted.

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.

09/01/07 22:12:18 changed by markjaquith

  • status changed from reopened to closed.
  • resolution set to fixed.

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

09/08/07 14:27:25 changed by markjaquith

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

09/10/07 15:34:14 changed by markjaquith

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

09/10/07 15:53:34 changed by markjaquith

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