瀏覽代碼

Ignore xml errors, fixes #951

Jordi Boggiano 6 年之前
父節點
當前提交
4b4c99699b
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/Packagist/WebBundle/Package/Updater.php

+ 4 - 0
src/Packagist/WebBundle/Package/Updater.php

@@ -645,6 +645,7 @@ class Updater
         $purifier = new \HTMLPurifier($config);
         $readme = $purifier->purify($readme);
 
+        libxml_use_internal_errors(true);
         $dom = new \DOMDocument();
         $dom->loadHTML('<?xml encoding="UTF-8">' . $readme);
 
@@ -692,6 +693,9 @@ class Updater
         $readme = substr($readme, strpos($readme, '<body>')+6);
         $readme = substr($readme, 0, strrpos($readme, '</body>'));
 
+        libxml_use_internal_errors(false);
+        libxml_clear_errors();
+
         return str_replace("\r\n", "\n", $readme);
     }