mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Fix using htmlspecialchars() whit the $double_encode parameter. PHP < 5.4 doesn't validate the entities.
Props miqrogroove. Fixes #17780. git-svn-id: https://develop.svn.wordpress.org/trunk@32851 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -688,6 +688,12 @@ function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = fals
|
||||
$quote_style = ENT_NOQUOTES;
|
||||
}
|
||||
|
||||
if ( ! $double_encode ) {
|
||||
// Guarantee every &entity; is valid, convert &garbage; into &garbage;
|
||||
// This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
|
||||
$string = wp_kses_normalize_entities( $string );
|
||||
}
|
||||
|
||||
$string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode );
|
||||
|
||||
// Backwards compatibility
|
||||
|
||||
Reference in New Issue
Block a user