WordPress.org

Make WordPress Core

Ticket #14279: 14279.diff

File 14279.diff, 896 bytes (added by solarissmoke, 2 years ago)
  • wp-includes/comment.php

     
    13261326        $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] ); 
    13271327        $commentdata['comment_agent']     = substr($_SERVER['HTTP_USER_AGENT'], 0, 254); 
    13281328 
    1329         $commentdata['comment_date']     = current_time('mysql'); 
    1330         $commentdata['comment_date_gmt'] = current_time('mysql', 1); 
     1329        if( empty( $commentdata['comment_date'] ) || ! strtotime( $commentdata['comment_date'] ) ) 
     1330                $commentdata['comment_date'] = current_time('mysql'); 
     1331        if( empty( $commentdata['comment_date_gmt'] ) || ! strtotime( $commentdata['comment_date_gmt'] ) ) 
     1332                $commentdata['comment_date_gmt'] = current_time('mysql', 1); 
    13311333 
    13321334        $commentdata = wp_filter_comment($commentdata); 
    13331335