From a7d8f6aa749928712d1455d7f4e0065ec770d645 Mon Sep 17 00:00:00 2001 From: rob1n Date: Fri, 6 Apr 2007 04:21:21 +0000 Subject: [PATCH] Re-encode query values after passed to add_query_arg(). Props mdawaffe. fixes #4084 git-svn-id: http://svn.automattic.com/wordpress/trunk@5193 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index b0d02ba28..3ebd32eac 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -815,6 +815,7 @@ function add_query_arg() { foreach($qs as $k => $v) { if ( $v !== FALSE ) { + $v = rawurlencode($v); if ( $ret != '' ) $ret .= '&'; if ( empty($v) && !preg_match('|[?&]' . preg_quote($k, '|') . '=|', $query) ) @@ -823,10 +824,11 @@ function add_query_arg() { $ret .= "$k=$v"; } } + $ret = trim($ret, '?'); $ret = $protocol . $base . $ret . $frag; if ( get_magic_quotes_gpc() ) $ret = stripslashes($ret); // parse_str() adds slashes if magicquotes is on. See: http://php.net/parse_str - return trim($ret, '?'); + return $ret; } /*