WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#6723 closed defect (bug) (fixed)

get_page_uri returns invalid URLs for multibyte page slug

Reported by: lilyfan Owned by: ryan
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5
Component: I18N Keywords: permalink, slug
Focuses: Cc:

Description

If a page has a multibyte page slug (like %E4%BE%8B ; means "example" in japanese), get_page_uri() returns invalid URL as "http://example.com/例/". It is not compliant with RFC 1748, because a UTF-8 character is inlcuded in the path.
The reason is that get_page_uri() does "urldecode($page->post_name)". Thus "%E4%BE%8B" is decoded to "例" (a UTF-8 character).

The solution is to avoid using urldecode().

Attachments (1)

page-encoded-urls.diff (631 bytes) - added by nbachiyski 7 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 @ryan7 years ago

  • Owner changed from anonymous to ryan

comment:2 @nbachiyski7 years ago

The urldecode calls were introduced long ago in [1841] (1.3-alpha-4) when for some reason page names were double encoded.

The patch is attached.

comment:3 @ryan7 years ago

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

(In [8096]) Don't decode slug in get_page_uri(). Props nbachiyski. fixes #6723

Note: See TracTickets for help on using tickets.