Ensure that wp_specialchars captures all pre-encoded entities correctly when preventing double encoding. Fixes #9821.

git-svn-id: http://svn.automattic.com/wordpress/trunk@11338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2009-05-15 06:29:19 +00:00
parent b0ae00fc0c
commit 378aaa973e
1 changed files with 2 additions and 2 deletions

View File

@ -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 );