Ticket #5998: 5998-comment-php.3.patch

File 5998-comment-php.3.patch, 1.2 KB (added by hakre, 2 years ago)

refreshed against trunk

  • wp-includes/comment.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    12351235 * @return int The ID of the comment after adding. 
    12361236 */ 
    12371237function wp_new_comment( $commentdata ) { 
     1238    if ( get_bloginfo('html_type') == 'application/xhtml+xml'  
     1239         && get_bloginfo('charset') == 'UTF-8' ) { 
     1240        if ( $xml_parser = xml_parser_create('UTF-8') ){ 
     1241            $fake_xml_wrap = '<pre>' . $commentdata['comment_content'] . '</pre>'; 
     1242            if (!xml_parse($xml_parser, $fake_xml_wrap)) { 
     1243                $err = sprintf('XML error: %s at line %d column %d', 
     1244                         xml_error_string(xml_get_error_code($xml_parser)), 
     1245                         xml_get_current_line_number($xml_parser), 
     1246                         xml_get_current_column_number($xml_parser)); 
     1247                wp_die( __($err) ); 
     1248            } 
     1249        } 
     1250        xml_parser_free($xml_parser); 
     1251    } 
    12381252        $commentdata = apply_filters('preprocess_comment', $commentdata); 
    12391253 
    12401254        $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];