1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-22 11:51:17 +01:00

Handle unclosed br XML tags

This commit is contained in:
Daniil Gentili 2022-07-28 18:37:04 +02:00
parent 1c7ce62802
commit 604ff7171c
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -23,6 +23,7 @@ final class DOMEntities
public function __construct(string $html)
{
$dom = new \DOMDocument();
$html = \preg_replace("/\<br(\s*)?\/?\>/i", "\n", $html);
$dom->loadxml("<body>" . \str_replace(['&amp;', '&#039;', '&quot;', '&'], ['&', '\'', "\"", '&amp;'], \trim($html)) . "</body>");
$this->parseNode($dom->getElementsByTagName('body')->item(0), 0);
}