Prevented bad duplicate IDs causing major exception

Related to #1393
This commit is contained in:
Dan Brown
2019-04-15 21:20:32 +01:00
parent 95d4149d5e
commit c380c10d54
2 changed files with 18 additions and 0 deletions

View File

@ -715,6 +715,7 @@ class EntityRepo
}
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML(mb_convert_encoding('<body>'.$matchedPage->html.'</body>', 'HTML-ENTITIES', 'UTF-8'));
$matchingElem = $doc->getElementById($splitInclude[1]);
if ($matchingElem === null) {
@ -730,6 +731,7 @@ class EntityRepo
$innerContent .= $doc->saveHTML($childNode);
}
}
libxml_clear_errors();
$html = str_replace($matches[0][$index], trim($innerContent), $html);
}