Ticket #1431: functions-formatting.patch

File functions-formatting.patch, 1.2 KB (added by Kafkaesqui, 7 years ago)

Corrects ampersand conversion preg_replace lines to account for certain character entities

  • functions-formatting.php

     
    4141                } else { 
    4242                        $next = true; 
    4343                } 
    44                 $curl = preg_replace('/&([^#])(?![a-z12]{1,8};)/', '&$1', $curl); 
     44                $curl = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $curl); 
    4545                $output .= $curl; 
    4646        } 
    4747        return $output; 
     
    9898 
    9999function wp_specialchars( $text, $quotes = 0 ) { 
    100100        // Like htmlspecialchars except don't double-encode HTML entities 
    101         $text = preg_replace('/&([^#])(?![a-z12]{1,8};)/', '&$1', $text);- 
     101        $text = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $text); 
    102102        $text = str_replace('<', '&lt;', $text); 
    103103        $text = str_replace('>', '&gt;', $text); 
    104104        if ( $quotes ) { 
     
    345345        $content = preg_replace('/<category>(.+?)<\/category>/','',$content); 
    346346 
    347347        // Converts lone & characters into &#38; (a.k.a. &amp;) 
    348         $content = preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $content); 
     348        $content = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&#038;$1', $content); 
    349349 
    350350        // Fix Word pasting 
    351351        $content = strtr($content, $wp_htmltranswinuni);