WordPress.org

Make WordPress Core

Ticket #9716: 9716.2.patch

File 9716.2.patch, 1.2 KB (added by SergeyBiryukov, 3 years ago)
  • wp-admin/plugin-editor.php

     
    5252 
    5353        check_admin_referer('edit-plugin_' . $file); 
    5454 
    55         $newcontent = stripslashes($_POST['newcontent']); 
     55        $newcontent = str_replace( array( "\r\n", "\r" ), "\n", stripslashes( $_POST['newcontent'] ) ); 
    5656        if ( is_writeable($real_file) ) { 
    5757                $f = fopen($real_file, 'w+'); 
    5858                fwrite($f, $newcontent); 
  • wp-admin/theme-editor.php

     
    8585switch( $action ) { 
    8686case 'update': 
    8787        check_admin_referer( 'edit-theme_' . $file . $stylesheet ); 
    88         $newcontent = stripslashes( $_POST['newcontent'] ); 
     88        $newcontent = str_replace( array( "\r\n", "\r" ), "\n", stripslashes( $_POST['newcontent'] ) ); 
    8989        $location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto; 
    9090        if ( is_writeable( $file ) ) { 
    9191                //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable