[wp-trac] [WordPress Trac] #31939: paginate_links() - incorrect links on return to the first page

WordPress Trac noreply at wordpress.org
Thu Apr 9 15:10:21 UTC 2015


#31939: paginate_links() - incorrect links on return to the first page
-----------------------------------------------+---------------------------
 Reporter:  bobbingwide                        |       Owner:
     Type:  defect (bug)                       |      Status:  new
 Priority:  normal                             |   Milestone:  Future
Component:  Themes                             |  Release
 Severity:  normal                             |     Version:  4.1.1
 Keywords:  4.3-early has-patch needs-testing  |  Resolution:
                                               |     Focuses:
-----------------------------------------------+---------------------------
Changes (by boonebgorges):

 * keywords:  2nd-opinion => 4.3-early has-patch needs-testing
 * milestone:  Awaiting Review => Future Release


Comment:

 Thanks for the report, bobbingwide. The technique used to avoid
 overwriting the custom pagination query var in [31203] is problematic in
 two ways.

 First, using `parse_url( $url, PHP_URL_QUERY )` doesn't work properly when
 the `$url` contains a `#` - anything after the first `#` is interpreted as
 part of the 'fragment' rather than the 'query'. See
 https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes
 /general-template.php?marks=2632#L2629. When `$args['base']` contains `#`
 - which it almost always will - this parsing will be broken. Instead of
 relying on `parse_url()`, we can just explode on `?`.

 Second, `remove_query_arg()` doesn't know what to do with a string like
 'foo', you get when you parse the querystring out of `example.com/?foo`.
 That is, `remove_query_arg( 'foo', 'foo' )` will do nothing. We need a
 technique for removing the query args that is agnostic between query vars
 that have values (`?foo=bar`) and those that don't (`?foo`).
 https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes
 /general-template.php?marks=2636#L2629

 Have a look at the new parsing I'm proposing in [attachment:31939.diff].

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31939#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list