Index: src/wp-includes/class-wp-comment-query.php
===================================================================
--- src/wp-includes/class-wp-comment-query.php	(revision 36989)
+++ src/wp-includes/class-wp-comment-query.php	(working copy)
@@ -782,9 +782,12 @@
 					$q_values = explode( ',', $q_values );
 				}

-				// 'any' will cause the query var to be ignored.
 				if ( in_array( 'any', $q_values, true ) || empty( $q_values ) ) {
-					continue;
+					if ( 'post_type' === $field_name ) {
+						$q_values = get_post_types( array( 'exclude_from_search' => false ) );
+					} else {
+						$q_values = get_post_stati( array( 'exclude_from_search' => false ) );
+					}
 				}

 				$join_posts_table = true;
Index: tests/phpunit/tests/comment/query.php
===================================================================
--- tests/phpunit/tests/comment/query.php	(revision 36989)
+++ tests/phpunit/tests/comment/query.php	(working copy)
@@ -1828,6 +1829,29 @@
 	}

 	/**
+	 * @ticket 36208
+	 */
+	public function test_post_type_any_ignores_inactive_post_types() {
+		register_post_type( 'post-type-1', array( 'exclude_from_search' => false ) );
+		register_post_type( 'post-type-2', array( 'exclude_from_search' => false ) );
+
+		$p1 = self::factory()->post->create( array( 'post_type' => 'post-type-1' ) );
+		$p2 = self::factory()->post->create( array( 'post_type' => 'post-type-2' ) );
+
+		$c1 = self::factory()->comment->create_post_comments( $p1, 1 );
+		self::factory()->comment->create_post_comments( $p2, 1 );
+
+		_unregister_post_type( 'post-type-1' );
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'fields' => 'ids',
+			'post_type' => 'any',
+		) );
+
+		$this->assertEqualSets( array_merge( $c1 ), $found );
+	}
+
+	/**
 	 * @ticket 24826
 	 */
 	public function test_comment_query_object() {
