Ticket #2130: perfect-comments.diff

File perfect-comments.diff, 1.1 kB (added by skeltoac, 3 years ago)
  • wp-includes/kses.php

    old new  
    7777# matches stray ">" characters. 
    7878############################################################################### 
    7979{ 
    80         return preg_replace('%(<!--.*?-->)|(<'.# EITHER: < 
    81         '[^>]*'.# things that aren't > 
    82         '(>|$)'.# > or end of string 
    83         '|>)%e', # OR: just a > 
     80        return preg_replace('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%e', 
    8481        "wp_kses_split2('\\1', \$allowed_html, ".'$allowed_protocols)', $string); 
    8582} # function wp_kses_split 
    8683 
     
    9895                return '&gt;'; 
    9996        # It matched a ">" character 
    10097 
    101         if (preg_match('%^<!--(.*)-->$%', $string, $matches)) { 
    102                 $string = $matches[1]
     98        if (preg_match('%^<!--(.*?)(-->)?$%', $string, $matches)) { 
     99                $string = str_replace(array('<!--', '-->'), '', $matches[1])
    103100                while ( $string != $newstring = wp_kses($string, $allowed_html, $allowed_protocols) ) 
    104101                        $string = $newstring; 
     102                if ( $string == '' ) 
     103                        return ''; 
    105104                return "<!--{$string}-->"; 
    106105        } 
    107106        # Allow HTML comments