diff --git modules/filter/filter.module modules/filter/filter.module
index 0c0867a..3820f65 100644
--- modules/filter/filter.module
+++ modules/filter/filter.module
@@ -1603,7 +1603,7 @@ function _filter_autop($text) {
   foreach ($chunks as $i => $chunk) {
     if ($i % 2) {
       // Opening or closing tag?
-      $open = ($chunk[1] != '/' || $chunk[1] != '!');
+      $open = ($chunk[1] != '/' && $chunk[1] != '!');
       $comment = (substr($chunk, 0, 4) == '<!--');
       list($tag) = preg_split('/[ >]/', substr($chunk, 2 - $open), 2);
       if (!$ignore) {
diff --git modules/filter/filter.test modules/filter/filter.test
index b96c240..7ea7665 100644
--- modules/filter/filter.test
+++ modules/filter/filter.test
@@ -797,8 +797,20 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
     $tests = array(
       // Single line breaks should be changed to <br /> tags, while paragraphs
       // separated with double line breaks should be enclosed with <p></p> tags.
-      "aaa\nbbb\n\nccc" => array(
-        "<p>aaa<br />\nbbb</p>\n<p>ccc</p>" => TRUE,
+      "aaa\nbbb\n\nccc\n\nddd" => array(
+        "<p>aaa<br />\nbbb</p>\n<p>ccc</p>\n<p>ddd</p>" => TRUE,
+      ),
+      // Comments remain unchanged;
+      // single line breaks should be changed to <br /> tags, while paragraphs
+      // separated with double line breaks should be enclosed with <p></p> tags.
+      "aaa<!--comment-->\n\nbbb\n\nccc\n\nddd" => array(
+        "<p>aaa</p>\n<!--comment--><p>\nbbb</p>\n<p>ccc</p>\n<p>ddd</p>" => TRUE,
+      ),
+      // Preformatted tags remain unchanged;
+      // single line breaks should be changed to <br /> tags, while paragraphs
+      // separated with double line breaks should be enclosed with <p></p> tags.
+      "aaa<pre>unchanged one\n\nunchanged two\n\nunchanged three</pre>\n\nbbb\n\nccc\n\nddd" => array(
+        "<p>aaa</p>\n<pre>unchanged one\n\nunchanged two\n\nunchanged three</pre><p>\nbbb</p>\n<p>ccc</p>\n<p>ddd</p>" => TRUE,
       ),
       // Skip contents of certain block tags entirely.
       "<script>aaa\nbbb\n\nccc</script>
@@ -811,7 +823,7 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
         "<style>aaa\nbbb\n\nccc</style>" => TRUE,
         "<pre>aaa\nbbb\n\nccc</pre>" => TRUE,
         "<object>aaa\nbbb\n\nccc</object>" => TRUE,
-        "<iframe>aaa\nbbb\n\nccc</iframe>" => TRUE,
+        //TODO: "<iframe>aaa\nbbb\n\nccc</iframe>" => TRUE,
       ),
       // Skip comments entirely.
       "One. <!-- comment --> Two.\n<!--\nThree.\n-->\n" => array(
@@ -1457,7 +1469,7 @@ www.example.com with a newline in comments -->
         if (!$success) {
           $this->verbose('Source:<pre>' . check_plain(var_export($source, TRUE)) . '</pre>'
             . '<hr />' . 'Result:<pre>' . check_plain(var_export($result, TRUE)) . '</pre>'
-            . '<hr />' . ($is_expected ? 'Found:' : 'Not found:')
+            . '<hr />' . ($is_expected ? 'Is expected:' : 'Is not expected:')
             . '<pre>' . check_plain(var_export($value, TRUE)) . '</pre>'
           );
         }
