|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-03-13 10:57 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2017-03-13 10:57 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 11:00:01 2025 UTC |
Description: ------------ Using PHP 7.1 with Libxml version 2.9.4 DomDocument::loadHTML ignores LIBXML_NOCDATA. Test script: --------------- $doc = new \DomDocument(); $doc->loadHTML('<!doctype html> <html><head> <script> $().ready(function() {}); </script> </head> <body> </body> </html> ', LIBXML_NOCDATA); echo $doc->saveXML(null, LIBXML_NOCDATA); ?> Output: --------- <?xml version="1.0" standalone="yes"?> <!DOCTYPE html> <html><head> <script><![CDATA[ $().ready(function() {}); ]]></script> </head> <body> </body> </html> --------- Changing `loadHTML` to `loadXML` works as expected, no <![CDATA[ appears in the output. saveHTML also omits the CDATA tags but as I'm working with document fragments, this isn't helpful as it wraps everything with html and body tags.