WordPress.org

Make WordPress Core

Ticket #7041: no-cr-for-js-escape.diff

File no-cr-for-js-escape.diff, 631 bytes (added by nbachiyski, 6 years ago)
  • wp-includes/formatting.php

     
    11831183function js_escape($text) { 
    11841184        $safe_text = wp_specialchars($text, 'double'); 
    11851185        $safe_text = preg_replace('/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes($safe_text)); 
    1186         $safe_text = preg_replace("/\r?\n/", "\\n", addslashes($safe_text)); 
     1186        $safe_text = str_replace("\r", "", $safe_text); 
     1187        $safe_text = str_replace("\n", "\\n", addslashes($safe_text)); 
    11871188        return apply_filters('js_escape', $safe_text, $text); 
    11881189} 
    11891190