Ticket #51044: 51044.diff
File 51044.diff, 1.4 KB (added by , 4 years ago) |
---|
-
src/wp-includes/comment.php
2188 2188 2189 2189 $prefiltered_user_id = ( isset( $commentdata['user_id'] ) ) ? (int) $commentdata['user_id'] : 0; 2190 2190 2191 if ( ! isset( $commentdata['comment_author_IP'] ) ) { 2192 $commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR']; 2193 } 2194 2195 if ( ! isset( $commentdata['comment_agent'] ) ) { 2196 $commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : ''; 2197 } 2198 2191 2199 /** 2192 2200 * Filters a comment's data before it is sanitized and inserted into the database. 2193 2201 * … … 2211 2219 2212 2220 $commentdata['comment_parent'] = ( 'approved' === $parent_status || 'unapproved' === $parent_status ) ? $commentdata['comment_parent'] : 0; 2213 2221 2214 if ( ! isset( $commentdata['comment_author_IP'] ) ) {2215 $commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];2216 }2217 2222 $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '', $commentdata['comment_author_IP'] ); 2218 2223 2219 if ( ! isset( $commentdata['comment_agent'] ) ) {2220 $commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';2221 }2222 2224 $commentdata['comment_agent'] = substr( $commentdata['comment_agent'], 0, 254 ); 2223 2225 2224 2226 if ( empty( $commentdata['comment_date'] ) ) {