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