Only run a second spaces strip if we replaced some octets. Also only replace spaces and we have already removed the other whitespace chars. Fixes #11573 props azaozz.
git-svn-id: https://develop.svn.wordpress.org/trunk@12504 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e0f06bd939
commit
7d9a46e01c
@ -2841,11 +2841,16 @@ function sanitize_text_field($str) {
|
||||
}
|
||||
|
||||
$match = array();
|
||||
$found = false;
|
||||
while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) {
|
||||
$filtered = str_replace($match[0], '', $filtered);
|
||||
$found = true;
|
||||
}
|
||||
|
||||
if ( $found ) {
|
||||
// Strip out the whitespace that may now exist after removing the octets.
|
||||
$filtered = trim( preg_replace('/ +/', ' ', $filtered) );
|
||||
}
|
||||
// Strip out the whitespace that may now exist after removing the octets.
|
||||
$filtered = trim( preg_replace('/[\r\n\t ]+/', ' ', $filtered) );
|
||||
|
||||
return apply_filters('sanitize_text_field', $filtered, $str);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user