diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 209636dd75..e7a4e1ddfb 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -581,11 +581,18 @@ function addslashes_gpc($gpc) { } -function stripslashes_deep($value) -{ +function stripslashes_deep($value) { $value = is_array($value) ? - array_map('stripslashes_deep', $value) : - stripslashes($value); + array_map('stripslashes_deep', $value) : + stripslashes($value); + + return $value; +} + +function urlencode_deep($value) { + $value = is_array($value) ? + array_map('urlencode_deep', $value) : + urlencode($value); return $value; } diff --git a/wp-includes/functions.php b/wp-includes/functions.php index d7b2a1ae8d..c9d46a67f1 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -808,6 +808,7 @@ function add_query_arg() { parse_str($query, $qs); if ( get_magic_quotes_gpc() ) $qs = stripslashes_deep($qs); // parse_str() adds slashes if magicquotes is on. See: http://php.net/parse_str + $qs = urlencode_deep($qs); if ( is_array(func_get_arg(0)) ) { $kayvees = func_get_arg(0); $qs = array_merge($qs, $kayvees);