[wp-trac] [WordPress Trac] #51348: Trailing slash redirect removes pipes from query strings
WordPress Trac
noreply at wordpress.org
Mon Dec 14 23:53:06 UTC 2020
#51348: Trailing slash redirect removes pipes from query strings
--------------------------+------------------------------
Reporter: simjost | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Canonical | Version: 5.5.1
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Changes (by peterwilsoncc):
* keywords: close 2nd-opinion =>
Comment:
I've been able to reproduce and it looks like the query string is messed
up in `wp_sanitize_redirect()` which includes some quite complex regex,
the line causing the problem is:
{{{
$location = preg_replace( '|[^a-z0-9-~+_.?#=&;,/:%!*\[\]()@]|i', '',
$location );
}}}
As it appears browsers support the character unencoded, my inclination is
to encode it to `%7C` on redirects as
[https://tools.ietf.org/html/rfc2396#section-2.4.3 the RFC considers it
unwise].
My reasoning for this is that `wp_sanitize_redirect()` already does auto-
encoding for other characters that ought to be encoded but browsers
support in an unencoded state. @TimothyBlynJacobs is correct, it's pretty
messy ;)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51348#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list