Index: src/wp-includes/comment-template.php
--- src/wp-includes/comment-template.php Base (BASE)
+++ src/wp-includes/comment-template.php Locally Modified (Based On LOCAL)
@@ -433,32 +433,39 @@
 function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
 	global $comment_alt, $comment_depth, $comment_thread_alt;
 
-	$comment = get_comment($comment_id);
+	$comment = get_comment( $comment_id );
 
+	// Verify if comment is a WP_Comment object.
+	if ( ! $comment instanceof WP_Comment ) {
+		return array();
+	}
+
 	$classes = array();
 
-	// Get the comment type (comment, trackback),
+	// Get the comment type (comment, trackback).
 	$classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;
 
 	// Add classes for comment authors that are registered users.
-	if ( $comment->user_id > 0 && $user = get_userdata( $comment->user_id ) ) {
+	if ( ! empty( $comment->user_id ) && $user = get_userdata( $comment->user_id ) ) {
 		$classes[] = 'byuser';
 		$classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id );
-		// For comment authors who are the author of the post
-		if ( $post = get_post($post_id) ) {
+		// For comment authors who are the author of the post.
+		if ( $post = get_post( $post_id ) ) {
 			if ( $comment->user_id === $post->post_author ) {
 				$classes[] = 'bypostauthor';
 			}
 		}
 	}
 
-	if ( empty($comment_alt) )
+	if ( empty( $comment_alt ) ) {
 		$comment_alt = 0;
-	if ( empty($comment_depth) )
+	}
+	if ( empty( $comment_depth ) ) {
 		$comment_depth = 1;
-	if ( empty($comment_thread_alt) )
+	}
+	if ( empty( $comment_thread_alt ) ) {
 		$comment_thread_alt = 0;
-
+	}
 	if ( $comment_alt % 2 ) {
 		$classes[] = 'odd';
 		$classes[] = 'alt';
@@ -481,13 +488,14 @@
 
 	$classes[] = "depth-$comment_depth";
 
-	if ( !empty($class) ) {
-		if ( !is_array( $class ) )
-			$class = preg_split('#\s+#', $class);
-		$classes = array_merge($classes, $class);
+	if ( ! empty( $class ) ) {
+		if ( ! is_array( $class ) ) {
+			$class = preg_split( '#\s+#', $class );
 	}
+		$classes = array_merge( $classes, $class );
+	}
 
-	$classes = array_map('esc_attr', $classes);
+	$classes = array_map( 'esc_attr', $classes );
 
 	/**
 	 * Filter the returned CSS classes for the current comment.
Index: tests/phpunit/tests/comment/template.php
--- tests/phpunit/tests/comment/template.php Base (BASE)
+++ tests/phpunit/tests/comment/template.php Locally Modified (Based On LOCAL)
@@ -30,4 +30,19 @@
 		$this->assertEquals( 12, get_comments_number() );
 	}
 
+	/**
+	 * @ticket 33947
+	 */
+	public function test_get_comment_class_with_comment_id() {
+		$post_id = $this->factory->post->create();
+		$comment_id = $this->factory->comment->create( array( 'comment_post_ID' => $post_id ) );
+
+		$classes1 = get_comment_class( 'test', $comment_id );
+		$this->assertContains( 'test', $classes1 );
+
+		wp_delete_comment( $comment_id, true );
+
+		$classes2 = get_comment_class( 'test', $comment_id );
+		$this->assertEquals( array(), $classes2 );
 }
+}
\ No newline at end of file
