Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#26037 closed defect (bug) (duplicate)

wp_sanitize_redirect removing valid URIs characters

Reported by: omarabid's profile omarabid Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Validation Keywords: dev-feedback 2nd-opinion
Focuses: Cc:

Description

I'm using the wp_redirect function on one of my plugins. One of my users found out that in the redirect, the brackets are removed from the URL.

I dug a little bit and found the culprit to be the function "wp_sanitize_redirect" which removes the brackets.

Here is the regex expression that detects and removes unwanted characters

$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!]|i', '', $location);

Here are the accepted characters in a URI*

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=

So is there are a reason to remove this characters or is this a bug?

Change History (1)

#1 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #17052.

Note: See TracTickets for help on using tickets.