WordPress.org

Make WordPress Core

Ticket #11573: 11573.patch

File 11573.patch, 785 bytes (added by azaozz, 8 years ago)
  • wp-includes/formatting.php

     
    28412841        }
    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);
     2847                $found = true;
    28462848        }
    2847         // Strip out the whitespace that may now exist after removing the octets.
    2848         $filtered = trim( preg_replace('/[\r\n\t ]+/', ' ', $filtered) );
    28492849
     2850        if ( $found ) {
     2851                // Strip out the whitespace that may now exist after removing the octets.
     2852                $filtered = trim( preg_replace('/ +/', ' ', $filtered) );
     2853        }
     2854
    28502855        return apply_filters('sanitize_text_field', $filtered, $str);
    28512856}
    28522857