contentが空のときはHTMLとしてのパースを行わないようにする

This commit is contained in:
shibafu 2019-04-14 17:40:21 +09:00
parent 3cba46bff0
commit f95f1592f7

View File

@ -73,6 +73,10 @@ class ActivityPubResolver implements Resolver, Parser
private function html2text(string $html): string
{
if (empty($html)) {
return '';
}
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
$html = preg_replace('~<br\s*/?\s*>|</p>\s*<p[^>]*>~i', "\n", $html);
$dom = new \DOMDocument();