From 0b9fb4f1481fefc2414553832dd29e2e1bb343db Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 30 Jun 2014 11:02:10 +0000 Subject: [PATCH] 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 --- src/wp-includes/comment.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index 9629c58a28..dd45821c34 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -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.