WordPress.org

Make WordPress Core

Opened 20 months ago

Last modified 17 months ago

#38331 new defect (bug)

Pagination crashes when using Greek query arguments

Reported by: kouratoras Owned by:
Milestone: Future Release Priority: low
Severity: major Version: 4.1
Component: Canonical Keywords: needs-testing has-patch
Focuses: Cc:

Description

I have an issue in both WordPress stable (4.6.1) and nightly build (4.7-alpha-38801). It happens only when I have pretty permalinks structure (i.e. the default Day and name).

The steps to reproduce are:

  1. Set pretty permalinks structure (let's say Day and name)
  2. Create some posts in order to have pagination on the front-end
  3. I visit the front-end
  4. I go to page 2 (let's say /page/2/)
  5. I manually add some Greek query arguments in the URL (let's say /page/2/?φοο=βαρ) and click enter

What I see: the page crashes with a browser message The page isn't redirecting properly. No errors in debug log.

Attachments (1)

patch-38331 (1.0 KB) - added by dgwatkins 19 months ago.
re-encode keys and values

Download all attachments as: .zip

Change History (5)

#1 @johnbillion
20 months ago

  • Keywords needs-patch needs-testing added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 4.1

Confirmed. This occurs in WordPress versions back to 4.1, but not in 4.0 or earlier.

#2 @johnbillion
20 months ago

  • Component changed from Query to Canonical
  • Priority changed from normal to low
  • Severity changed from normal to major

#3 @dgwatkins
19 months ago

I did some debugging to see where this is coming from, here is what I found.

  • In redirect_canonical() we use remove_query_arg() when there is pagination.
  • This involves using parse_str() a couple of times, which has the side effect of urldecoding both the keys and the values in the query_string array.
  • Immediately after we re-encode the values to compensate the said side effect, but we leave the keys behind.

This difference causes the redirect,

Im attaching a patch that works, Im not sure if there is a better way of doing it.

@dgwatkins
19 months ago

re-encode keys and values

#4 @Presskopp
17 months ago

  • Keywords has-patch added; needs-patch removed
Note: See TracTickets for help on using tickets.