1--TEST--
2DOM\HTMLDocument::createFromString() - normal document, no error
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8// The closing p tag breaks libxml2's HTML parser, but doesn't break the HTML5 parser due to the script context parsing rules.
9$html = <<<HTML
10<!DOCTYPE HTML>
11<html>
12    <head>
13        <meta charset="utf-8">
14        <title>foo</title>
15    </head>
16    <body>
17        <script>
18        var foo = "</p>";
19        </script>
20        <p test="<script>">bar <!-- hi --></p>
21    </body>
22</html>
23HTML;
24$dom = DOM\HTMLDocument::createFromString($html);
25echo $dom->saveHTML(), "\n";
26
27?>
28--EXPECT--
29<!DOCTYPE html><html><head>
30        <meta charset="utf-8">
31        <title>foo</title>
32    </head>
33    <body>
34        <script>
35        var foo = "</p>";
36        </script>
37        <p test="<script>">bar <!-- hi --></p>
38
39</body></html>
40