|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74628 DOM auto remove HTML closing tag in <script> tag when save
Submitted: 2017-05-22 04:27 UTC Modified: 2017-05-22 16:37 UTC
Avg. Score:4.5 ± 0.8
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:0 (0.0%)
From: tidus2102 at gmail dot com Assigned:
Status: Suspended Package: DOM XML related
PHP Version: 7.1.5 OS: OSX El Capitan
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tidus2102 at gmail dot com
New email:
PHP Version: OS:


 [2017-05-22 04:27 UTC] tidus2102 at gmail dot com

DOM auto remove HTML closing tag in <script> tag when save. Please check test script below.

Test script:
$html = <<<HTML
        $dom = new DOMDocument();
        $dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', "UTF-8"), LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);

        echo $dom->saveHTML();

Expected result:
All content in <script> tag need to be exactly the same as original HTML code.


Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-22 16:37 UTC]
-Status: Open +Status: Suspended
 [2017-05-22 16:37 UTC]
Unfortunately, libxml isn't really HTML5 compatible yet, and there
isn't much we can do about that. You have to stick to conforming
HTML 4.01, and write <\/h1>, see <>.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Oct 31 10:01:23 2020 UTC