Make WordPress Core


Ignore:
Timestamp:
12/23/2009 11:00:29 AM (17 years ago)
Author:
westi
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/formatting.php

    r12503 r12504  
    28422842
    28432843        $match = array();
     2844        $found = false;
    28442845        while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) {
    28452846                $filtered = str_replace($match[0], '', $filtered);
    2846         }
    2847         // Strip out the whitespace that may now exist after removing the octets.
    2848         $filtered = trim( preg_replace('/[\r\n\t ]+/', ' ', $filtered) );
     2847                $found = true;
     2848        }
     2849
     2850        if ( $found ) {
     2851                // Strip out the whitespace that may now exist after removing the octets.
     2852                $filtered = trim( preg_replace('/ +/', ' ', $filtered) );
     2853        }
    28492854
    28502855        return apply_filters('sanitize_text_field', $filtered, $str);
Note: See TracChangeset for help on using the changeset viewer.