Skip to content

Commit 3294a4c

Browse files
authored
Merge pull request #237 from Lewiscowles1986/feature/php-8-and-8-1-ci
Feature/php 8 and 8.1 CI
2 parents 662d2eb + ade21a7 commit 3294a4c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: .github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
php: ['5.6', '7.3', '7.4']
14+
php: ['5.6', '7.3', '7.4', '8.0', '8.1']
1515

1616
runs-on: ubuntu-latest
1717

Diff for: Mf2/Parser.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,13 @@ class Parser {
364364
* @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.
365365
*/
366366
public function __construct($input, $url = null, $jsonMode = false) {
367+
$emptyDocDefault = '<html><body></body></html>';
367368
libxml_use_internal_errors(true);
368369
if (is_string($input)) {
370+
if (empty($input)) {
371+
$input = $emptyDocDefault;
372+
}
373+
369374
if (class_exists('Masterminds\\HTML5')) {
370375
$doc = new \Masterminds\HTML5(array('disable_html_ns' => true));
371376
$doc = $doc->loadHTML($input);
@@ -377,7 +382,7 @@ public function __construct($input, $url = null, $jsonMode = false) {
377382
$doc = clone $input;
378383
} else {
379384
$doc = new DOMDocument();
380-
@$doc->loadHTML('');
385+
@$doc->loadHTML($emptyDocDefault);
381386
}
382387

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

0 commit comments

Comments
 (0)