Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.706
diff -u -p -r1.706 comment.module
--- modules/comment/comment.module	27 Apr 2009 07:09:58 -0000	1.706
+++ modules/comment/comment.module	28 Apr 2009 01:16:56 -0000
@@ -709,7 +709,7 @@ function comment_node_update_index($node
   $text = '';
   $comments = db_query('SELECT subject, comment, format FROM {comment} WHERE nid = :nid AND status = :status', array(':nid' => $node->nid, ':status' => COMMENT_PUBLISHED));
   foreach ($comments as $comment) {
-    $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format, FALSE);
+    $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format, '', FALSE);
   }
   return $text;
 }
Index: modules/filter/filter.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.test,v
retrieving revision 1.19
diff -u -p -r1.19 filter.test
--- modules/filter/filter.test	25 Apr 2009 18:01:10 -0000	1.19
+++ modules/filter/filter.test	28 Apr 2009 02:27:59 -0000
@@ -178,6 +178,106 @@ class FilterAdminTestCase extends Drupal
   }
 }
 
+/**
+ * Test integration with other core modules.
+ */
+class FilterIntegrationTestCase extends DrupalWebTestCase {
+  protected $admin_user;
+
+  public static function getInfo() {
+    return array(
+      'name' => t('Filter integration'),
+      'description' => t('Verify text formats and filters used elsewhere.'),
+      'group' => t('Filter'),
+    );
+  }
+
+  function setUp() {
+    parent::setUp('comment', 'search');
+
+    $this->admin_user = $this->drupalCreateUser(array('administer filters', 'administer permissions', 'create page content', 'post comments without approval'));
+    $this->drupalLogin($this->admin_user);
+  }
+
+  /**
+   * Verify that comments are rendered using proper format in search results.
+   */
+  function testSearchResultsComment() {
+    $title = 'testSearchResultsComment';
+
+    // Enable comments for 'page' nodes.
+    variable_set('comment_page', COMMENT_NODE_OPEN);
+    variable_set('comment_preview_page', COMMENT_PREVIEW_OPTIONAL);
+    // Enable check_plain() for 'Filtered HTML' text format.
+    $edit = array(
+      'filters[filter/0]' => 1,
+      'filters[filter/1]' => 1,
+      'filters[filter/2]' => 1,
+      'filters[filter/3]' => 1,
+      'filters[filter/4]' => 1,
+    );
+    $this->drupalPost('admin/settings/filter/1', $edit, t('Save configuration'));
+    // Allow anonymous users to search content.
+    /**
+     *                     ,____
+     *                     |---.\
+     *             ___     |    `
+     *            / .-\  ./=)
+     *           |  |"|_/\/|
+     *           ;  |-;| /_|
+     *          / \_| |/ \ |
+     *         /      \/\( |
+     *         |   /  |` ) |
+     *         /   \ _/    |
+     *        /--._/  \    |
+     *        `/|)    |    /
+     *          /     |   |
+     *        .'      |   |
+     * jgs   /         \  |
+     *      (_.-.__.__./  /
+     * @see http://drupal.org/cvs?commit=79939
+     */
+    $edit = array(
+      DRUPAL_ANONYMOUS_RID . '[search content]' => 1,
+      // @todo Comments are added to search index without checking first whether
+      //   anonymous users are allowed to access comments.
+      DRUPAL_ANONYMOUS_RID . '[access comments]' => 1,
+      // @todo Without this permission, "Login or register to post comments" is
+      //   added to the search index.  Comment.module is not guilty; that text
+      //   seems to be added via node links.
+      DRUPAL_ANONYMOUS_RID . '[post comments]' => 1,
+    );
+    $this->drupalPost('admin/user/permissions', $edit, t('Save permissions'));
+
+    // Create a node.
+    $node = $this->drupalCreateNode(array('type' => 'page'));
+    // Post a comment using 'Full HTML' text format.
+    $edit_comment = array(
+      'subject' => $this->randomName(2, ''),
+      'comment' => '<h1>' . $title . '</h1>',
+      'comment_format' => 2,
+    );
+    $this->drupalPost('comment/reply/' . $node->nid, $edit_comment, t('Save'));
+
+    // Invoke search index update.
+    $this->drupalLogout();
+    $this->drupalGet($GLOBALS['base_url'] . '/cron.php', array('external' => TRUE, 'query' => 'cron_key=' . variable_get('cron_key', 'drupal')));
+
+    // Search for $title.
+    $edit = array(
+      'search_theme_form' => $title,
+    );
+    $this->drupalPost('', $edit, t('Search'));
+    $this->assertText($node->title, t('Node found in search results.'));
+
+    // Verify that comment is rendered using proper format.
+    $this->assertText($edit_comment['subject'], t('Comment subject found in search results.'));
+    $this->assertText($title, t('Comment body text found in search results.'));
+    $this->assertNoRaw(t('n/a'), t('HTML in comment body is not hidden.'));
+    $this->assertNoRaw(check_plain($edit_comment['comment']), t('HTML in comment body is not escaped.'));
+  }
+}
+
 class FilterTestCase extends DrupalWebTestCase {
   protected $format;
 
Index: modules/node/node.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.api.php,v
retrieving revision 1.14
diff -u -p -r1.14 node.api.php
--- modules/node/node.api.php	25 Apr 2009 16:33:48 -0000	1.14
+++ modules/node/node.api.php	28 Apr 2009 00:19:50 -0000
@@ -372,7 +372,7 @@ function hook_node_update_index($node) {
   $text = '';
   $comments = db_query('SELECT subject, comment, format FROM {comment} WHERE nid = :nid AND status = :status', array(':nid' => $node->nid, ':status' => COMMENT_PUBLISHED));
   foreach ($comments as $comment) {
-    $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format, FALSE);
+    $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format, '', FALSE);
   }
   return $text;
 }
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1042
diff -u -p -r1.1042 node.module
--- modules/node/node.module	26 Apr 2009 19:44:39 -0000	1.1042
+++ modules/node/node.module	28 Apr 2009 00:38:18 -0000
@@ -1507,9 +1507,9 @@ function node_search($op = 'search', $ke
         $node->body = drupal_render($node->content);
 
         // Fetch comments for snippet.
-        $node->body .= module_invoke('comment', 'node', $node, 'update_index');
+        $node->body .= module_invoke('comment', 'node_update_index', $node);
         // Fetch terms for snippet.
-        $node->body .= module_invoke('taxonomy', 'node', $node, 'update_index');
+        $node->body .= module_invoke('taxonomy', 'node_update_index', $node);
 
         $extra = module_invoke_all('node_search_result', $node);
 
