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
This commit is contained in:
Peter Westwood 2009-05-15 06:29:19 +00:00
parent 33dfbfe434
commit eef75a9675
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 );