WordPress.org

Make WordPress Core

Ticket #25021: 25021.negative-lookahead.diff

File 25021.negative-lookahead.diff, 799 bytes (added by duck_, 6 years ago)
  • src/wp-includes/formatting.php

     
    992992 */
    993993function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) {
    994994        $title = strip_tags($title);
    995         // Preserve escaped octets.
    996         $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
    997995        // Remove percent signs that are not part of an octet.
    998         $title = str_replace('%', '', $title);
    999         // Restore octets.
    1000         $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
     996        $title = preg_replace( '/%(?![a-fA-F0-9][a-fA-F0-9])/', '', $title );
    1001997
    1002998        if (seems_utf8($title)) {
    1003999                if (function_exists('mb_strtolower')) {