Explorar o código

Ignore xml errors, fixes #951

Jordi Boggiano %!s(int64=6) %!d(string=hai) anos
pai
achega
4b4c99699b
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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);
     }