Make WordPress Core

Opened 7 years ago

Closed 16 months ago

#38331 closed defect (bug) (worksforme)

Pagination crashes when using Greek query arguments

Reported by: kouratoras's profile kouratoras Owned by:
Milestone: Priority: low
Severity: major Version: 4.1
Component: Canonical Keywords: needs-testing has-patch close
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 7 years ago.
re-encode keys and values

Download all attachments as: .zip

Change History (7)

#1 @johnbillion
7 years 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
7 years ago

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

#3 @dgwatkins
7 years 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
7 years ago

re-encode keys and values

#4 @Presskopp
7 years ago

  • Keywords has-patch added; needs-patch removed

#5 @bradleyt
4 years ago

  • Keywords close added

I'm currently unable to reproduce this issue. It looks like this may have been fixed in #43745.

#6 @JeffPaul
16 months ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Closing as no longer reproducible, thanks all for the research & testing on this.

Note: See TracTickets for help on using tickets.