]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/lib/washtml.php
Imported Debian patch 0.5.2+dfsg-1
[roundcube.git] / program / lib / washtml.php
index 7f49fec283000286c418883ccfddfc41071bf600..e8befe835e92934d4247875cf8760d237af5cec0 100644 (file)
@@ -75,6 +75,7 @@
  * - changed $ignore_elements behaviour
  * - added RFC2397 support
  * - base URL support
+ * - invalid HTML comments removal before parsing
  */
 
 class washtml
@@ -271,6 +272,10 @@ class washtml
     else
       $this->config['base_url'] = '';
 
+    // Remove invalid HTML comments (#1487759)
+    // Don't remove valid conditional comments
+    $html = preg_replace('/<!--[^->[]*>/', '', $html);
+
     @$node->loadHTML($html);
     return $this->dumpHtml($node);
   }