diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 5a1b2e22eb..e07a4b1b1d 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -22,10 +22,11 @@ * @return string The comment author */ function get_comment_author( $comment_ID = 0 ) { - $comment = get_comment( $comment_ID ); + $comment = get_comment( $comment_ID ); + $comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_ID; if ( empty( $comment->comment_author ) ) { - $user = $comment->user_id ? get_userdata( $comment->user_id ) : false; + $user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false; if ( $user ) { $author = $user->display_name; } else { @@ -45,7 +46,7 @@ function get_comment_author( $comment_ID = 0 ) { * @param string $comment_ID The comment ID as a numeric string. * @param WP_Comment $comment The comment object. */ - return apply_filters( 'get_comment_author', $author, $comment->comment_ID, $comment ); + return apply_filters( 'get_comment_author', $author, $comment_ID, $comment ); } /** @@ -663,7 +664,8 @@ function comment_excerpt( $comment_ID = 0 ) { * @return string The comment ID as a numeric string. */ function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid - $comment = get_comment(); + $comment = get_comment(); + $comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0'; /** * Filters the returned comment ID. @@ -674,7 +676,7 @@ function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFun * @param string $comment_ID The current comment ID as a numeric string. * @param WP_Comment $comment The comment object. */ - return apply_filters( 'get_comment_ID', $comment->comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase + return apply_filters( 'get_comment_ID', $comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 92502cd356..abf1f3095f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52817'; +$wp_version = '6.0-alpha-52818'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.