Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
php: ['5.6', '7.3', '7.4']
php: ['5.6', '7.3', '7.4', '8.0', '8.1']

runs-on: ubuntu-latest

Expand Down
7 changes: 6 additions & 1 deletion Mf2/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,13 @@ class Parser {
* @param boolean $jsonMode Whether or not to use a stdClass instance for an empty `rels` dictionary. This breaks PHP looping over rels, but allows the output to be correctly serialized as JSON.
*/
public function __construct($input, $url = null, $jsonMode = false) {
$emptyDocDefault = '<html><body></body></html>';
libxml_use_internal_errors(true);
if (is_string($input)) {
if (empty($input)) {
$input = $emptyDocDefault;
}

if (class_exists('Masterminds\\HTML5')) {
$doc = new \Masterminds\HTML5(array('disable_html_ns' => true));
$doc = $doc->loadHTML($input);
Expand All @@ -377,7 +382,7 @@ public function __construct($input, $url = null, $jsonMode = false) {
$doc = clone $input;
} else {
$doc = new DOMDocument();
@$doc->loadHTML('');
@$doc->loadHTML($emptyDocDefault);
}

// Create an XPath object and allow some PHP functions to be used within XPath queries.
Expand Down