WordPress.org

Make WordPress Core

Ticket #28506: control_char_filter.diff

File control_char_filter.diff, 603 bytes (added by mauteri, 5 years ago)

Diff

  • wp-includes/formatting.php

     
    154154                $dynamic[ '/(?<!xn)--/' ] = $en_dash;
    155155                $dynamic[ '/(?<=' . $spaces . ')-(?=' . $spaces . ')/' ] = $en_dash;
    156156
     157                // Remove control (non-printing) characters, but preserve line feeds and carriage returns (\r and \n).
     158                $dynamic[ '/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F]/' ] = '';
     159
    157160                $dynamic_characters = array_keys( $dynamic );
    158161                $dynamic_replacements = array_values( $dynamic );
    159162        }