From eef75a96757f82d707883a25c8a68b219feb36b5 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Fri, 15 May 2009 06:29:19 +0000 Subject: [PATCH] Ensure that wp_specialchars captures all pre-encoded entities correctly when preventing double encoding. Fixes #9821. git-svn-id: https://develop.svn.wordpress.org/trunk@11338 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 5aadc0ab64..c8561e3af2 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -240,11 +240,11 @@ function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false } elseif ( $quote_style === 'single' ) { $quote_style = ENT_NOQUOTES; } - + // Handle double encoding ourselves if ( !$double_encode ) { $string = wp_specialchars_decode( $string, $_quote_style ); - $string = preg_replace( '/&(#?x?[0-9]+|[a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string ); + $string = preg_replace( '/&(#?x?[0-9a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string ); } $string = @htmlspecialchars( $string, $quote_style, $charset );