Skip to content

Commit c42bc26

Browse files
Overcome empty document error for PHP8+
1 parent 6360120 commit c42bc26

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Mf2/Parser.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ class Parser {
366366
public function __construct($input, $url = null, $jsonMode = false) {
367367
libxml_use_internal_errors(true);
368368
if (is_string($input)) {
369+
if (empty($input)) {
370+
$input = '<html><body></body></html>';
371+
}
372+
369373
if (class_exists('Masterminds\\HTML5')) {
370374
$doc = new \Masterminds\HTML5(array('disable_html_ns' => true));
371375
$doc = $doc->loadHTML($input);

0 commit comments

Comments
 (0)