Avoid a PHP notice in wp_new_comment() if user ID is not passed.

see #23231.
Built from https://develop.svn.wordpress.org/trunk@28922


git-svn-id: http://core.svn.wordpress.org/trunk@28721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-06-30 11:03:14 +00:00
parent 706f85d814
commit c8d8610a15

View File

@ -1745,7 +1745,8 @@ function wp_new_comment( $commentdata ) {
if ( isset( $commentdata['user_ID'] ) ) {
$commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
}
$prefiltered_user_id = $commentdata['user_id'];
$prefiltered_user_id = ( isset( $commentdata['user_id'] ) ) ? (int) $commentdata['user_id'] : 0;
/**
* Filter a comment's data before it is sanitized and inserted into the database.