Make WordPress Core

Changeset 24275


Ignore:
Timestamp:
05/16/2013 12:06:36 PM (12 years ago)
Author:
ryan
Message:

Check for empty user agent to avoid notice.

Props sergej.mueller
fixes #22979

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r24214 r24275  
    13861386
    13871387    $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
    1388     $commentdata['comment_agent']     = substr($_SERVER['HTTP_USER_AGENT'], 0, 254);
     1388    $commentdata['comment_agent']     = isset( $_SERVER['HTTP_USER_AGENT'] ) ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 ) : '';
    13891389
    13901390    $commentdata['comment_date']     = current_time('mysql');
Note: See TracChangeset for help on using the changeset viewer.