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

see #23231.

git-svn-id: https://develop.svn.wordpress.org/trunk@28922 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-06-30 11:02:10 +00:00
parent 1d38109297
commit 0b9fb4f148

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.