From 944e80881bc66608d23c5aad49b02d2ba689b433 Mon Sep 17 00:00:00 2001 From: Antoine Aflalo Date: Mon, 29 May 2017 14:35:30 -0400 Subject: [PATCH] Avoid problem with HTML with fault This disable the warnings when loading the HTML to avoid the "htmlParseEntityRef: expecting ';'" that can happen when the HTML is not following the RFC to the line but still valid. https://stackoverflow.com/questions/1685277/warning-domdocumentloadhtml-htmlparseentityref-expecting-in-entity --- src/CssInlinerPlugin.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CssInlinerPlugin.php b/src/CssInlinerPlugin.php index f75283c..9c8f1ff 100644 --- a/src/CssInlinerPlugin.php +++ b/src/CssInlinerPlugin.php @@ -84,7 +84,13 @@ public function loadOptions($options) public function loadCssFilesFromLinks($message) { $dom = new \DOMDocument(); + // set error level + $internalErrors = libxml_use_internal_errors(true); + $dom->loadHTML($message); + + // Restore error level + libxml_use_internal_errors($internalErrors); $link_tags = $dom->getElementsByTagName('link'); if ($link_tags->length > 0) {