WordPress.org

Make WordPress Core

Ticket #9821: wp_specialchars.diff

File wp_specialchars.diff, 772 bytes (added by westi, 5 years ago)

Proposed fix to wp_specialchars so that it catches all existing entities

  • wordpress/wp-includes/formatting.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-tests
     
    240240        } elseif ( $quote_style === 'single' ) { 
    241241                $quote_style = ENT_NOQUOTES; 
    242242        } 
    243  
     243         
    244244        // Handle double encoding ourselves 
    245245        if ( !$double_encode ) { 
    246246                $string = wp_specialchars_decode( $string, $_quote_style ); 
    247                 $string = preg_replace( '/&(#?x?[0-9]+|[a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string ); 
     247                $string = preg_replace( '/&(#?x?[0-9A-Za-z]+);/i', '|wp_entity|$1|/wp_entity|', $string ); 
    248248        } 
    249249 
    250250        $string = @htmlspecialchars( $string, $quote_style, $charset );