Correctly encode spaces in URLs passed to `esc_url()` instead of removing them.

Fixes #23605
Props enshrined, johnbillion

Built from https://develop.svn.wordpress.org/trunk@33858


git-svn-id: http://core.svn.wordpress.org/trunk@33826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2015-09-02 17:20:21 +00:00
parent 3d1c08a1a5
commit 6aad2eb98c
2 changed files with 4 additions and 1 deletions

View File

@ -3274,11 +3274,14 @@ function esc_url( $url, $protocols = null, $_context = 'display' ) {
if ( '' == $url )
return $url;
$url = str_replace( ' ', '%20', $url );
$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
if ( 0 !== stripos( $url, 'mailto:' ) ) {
$strip = array('%0d', '%0a', '%0D', '%0A');
$url = _deep_replace($strip, $url);
}
$url = str_replace(';//', '://', $url);
/* If the URL doesn't appear to contain a scheme, we
* presume it needs http:// appended (unless a relative

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-33857';
$wp_version = '4.4-alpha-33858';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.