Comments: Avoid PHP notice in `get_comment_reply_link()` for `null` comment.

If there is no global comment, or the input comment is null, return early to prevent warnings.

Fixes #41846
Props birgire, earnjam


Built from https://develop.svn.wordpress.org/trunk@46335


git-svn-id: http://core.svn.wordpress.org/trunk@46134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
whyisjake 2019-09-27 14:46:57 +00:00
parent 188416bd55
commit d4c6ebeb89
2 changed files with 5 additions and 1 deletions

View File

@ -1646,6 +1646,10 @@ function get_comment_reply_link( $args = array(), $comment = null, $post = null
$comment = get_comment( $comment ); $comment = get_comment( $comment );
if ( empty( $comment ) ) {
return;
}
if ( empty( $post ) ) { if ( empty( $post ) ) {
$post = $comment->comment_post_ID; $post = $comment->comment_post_ID;
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-beta1-46334'; $wp_version = '5.3-beta1-46335';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.