From 4c61d32c3c3cfcb66142ed70d5c5d4fe01a5c396 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 4 Jun 2024 15:29:13 +0000 Subject: [PATCH] Comments: Ensure the correct comment ID type is passed to `get_comment_author`. The `$comment_id` parameter of the `get_comment_author` filter is documented as a numeric string, however in case a non-existing comment ID is passed to the `get_comment_author()` function, it could be an integer instead. This commit resolves the issue and adds a PHPUnit test demonstrating the behavior. Includes updating `get_comment_author_url()` unit tests for consistency. Follow-up to [41127], [52818]. Props david.binda. Fixes #60475. Built from https://develop.svn.wordpress.org/trunk@58335 git-svn-id: http://core.svn.wordpress.org/trunk@57791 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index d125f0c2dd..8c56097333 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -24,7 +24,7 @@ function get_comment_author( $comment_id = 0 ) { $comment = get_comment( $comment_id ); - $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_id; + $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; if ( empty( $comment->comment_author ) ) { $user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false; diff --git a/wp-includes/version.php b/wp-includes/version.php index ace5ed3e94..477c43aeaf 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.6-alpha-58334'; +$wp_version = '6.6-alpha-58335'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.