mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 19:46:21 +00:00
Formatting: Make sure wp_sanitize_redirect()
encodes spaces in URLs instead of stripping them out.
Props donmhico, hlashbrooke, dd32, azaozz. Fixes #36998. Built from https://develop.svn.wordpress.org/trunk@46462 git-svn-id: http://core.svn.wordpress.org/trunk@46260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
97356bbd75
commit
b78a40aa4c
@ -1280,6 +1280,9 @@ if ( ! function_exists( 'wp_sanitize_redirect' ) ) :
|
|||||||
* @return string Redirect-sanitized URL.
|
* @return string Redirect-sanitized URL.
|
||||||
*/
|
*/
|
||||||
function wp_sanitize_redirect( $location ) {
|
function wp_sanitize_redirect( $location ) {
|
||||||
|
// Encode spaces.
|
||||||
|
$location = str_replace( ' ', '%20', $location );
|
||||||
|
|
||||||
$regex = '/
|
$regex = '/
|
||||||
(
|
(
|
||||||
(?: [\xC2-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx
|
(?: [\xC2-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx
|
||||||
@ -1296,7 +1299,7 @@ if ( ! function_exists( 'wp_sanitize_redirect' ) ) :
|
|||||||
$location = preg_replace( '|[^a-z0-9-~+_.?#=&;,/:%!*\[\]()@]|i', '', $location );
|
$location = preg_replace( '|[^a-z0-9-~+_.?#=&;,/:%!*\[\]()@]|i', '', $location );
|
||||||
$location = wp_kses_no_null( $location );
|
$location = wp_kses_no_null( $location );
|
||||||
|
|
||||||
// remove %0d and %0a from location
|
// Remove %0D and %0A from location.
|
||||||
$strip = array( '%0d', '%0a', '%0D', '%0A' );
|
$strip = array( '%0d', '%0a', '%0D', '%0A' );
|
||||||
return _deep_replace( $strip, $location );
|
return _deep_replace( $strip, $location );
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-beta3-46461';
|
$wp_version = '5.3-beta3-46462';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user