From 55d7366c423cbbbaf5371d80806e9630e9fcdff2 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 26 Jul 2011 19:44:18 +0000 Subject: [PATCH] Recognize urls that start with a question mark as relative urls that do not require a scheme to be prepended. fixes #18260 git-svn-id: http://svn.automattic.com/wordpress/trunk@18469 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index b42f5e9e0..f6a9d6a0b 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -2256,10 +2256,10 @@ function esc_url( $url, $protocols = null, $_context = 'display' ) { $url = str_replace(';//', '://', $url); /* If the URL doesn't appear to contain a scheme, we * presume it needs http:// appended (unless a relative - * link starting with / or a php file). + * link starting with /, # or ? or a php file). */ - if ( strpos($url, ':') === false && - substr( $url, 0, 1 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) ) + if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) && + ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) $url = 'http://' . $url; // Replace ampersands and single quotes only when displaying.