Skip to content

[Bug]: HTMLEntry/HTMLType cannot read not-strict HTML #2009

@stloyd

Description

@stloyd

What happened?

If parsed HTML is not strictly valid, right now HTMLEntry and/or HTMLType can produce a PHP warning:

In HTMLEntry.php line 35:
                                                                                                                          
  [ErrorException]                                                                                                        
  Warning: Dom\HTMLDocument::createFromString(): tree error unexpected-closed-token in Entity, line: 2117, column: 15-19

How to reproduce?

        $html = <<<'HTML'
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
    <div>foo</div>
    <div><p><span>bar</span></span></p></div>
</body>
</html>
HTML;
        $entry = html_entry('html', $html);

Data required to reproduce bug locally

As above, try to read HTML that is not strictly valid, like having duplicated close tags.

Version

0.27

Relevant error output

In HTMLEntry.php line 35:
                                                                                                                          
  [ErrorException]                                                                                                        
  Warning: Dom\HTMLDocument::createFromString(): tree error unexpected-closed-token in Entity, line: 2117, column: 15-19

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions