WordPress.org

Make WordPress Core

Ticket #11311: 11311.patch

File 11311.patch, 806 bytes (added by Viper007Bond, 4 years ago)

Would something like this work?

  • wp-includes/kses.php

     
    948948function wp_kses_normalize_entities($string) { 
    949949        # Disarm all entities by converting & to & 
    950950 
    951         $string = str_replace('&', '&', $string); 
     951        $string = str_replace('&', '%%ampplaceholder%%', $string); 
    952952 
    953953        # Change back the allowed entities in our entity whitelist 
    954954 
     
    956956        $string = preg_replace_callback('/&#0*([0-9]{1,5});/', 'wp_kses_normalize_entities2', $string); 
    957957        $string = preg_replace_callback('/&#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', 'wp_kses_normalize_entities3', $string); 
    958958 
     959        $string = str_replace('%%ampplaceholder%%', '&', $string); 
     960 
    959961        return $string; 
    960962} 
    961963