mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Bail early when invalid ID is passed to get_comment_class().
This helps to avoid PHP notices later in the function. Props walterebert, dipesh.kakadiya, DrewAPicture. Fixes #33947. git-svn-id: https://develop.svn.wordpress.org/trunk@34454 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -433,10 +433,13 @@ function comment_class( $class = '', $comment = null, $post_id = null, $echo = t
|
||||
function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
|
||||
global $comment_alt, $comment_depth, $comment_thread_alt;
|
||||
|
||||
$comment = get_comment($comment_id);
|
||||
|
||||
$classes = array();
|
||||
|
||||
$comment = get_comment( $comment_id );
|
||||
if ( ! $comment ) {
|
||||
return $classes;
|
||||
}
|
||||
|
||||
// Get the comment type (comment, trackback),
|
||||
$classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user