|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-10-01 06:51 UTC] moltendorf at gmail dot com
[2009-10-01 07:00 UTC] moltendorf at gmail dot com
[2014-07-13 02:23 UTC] yohgaki@php.net
-Type: Bug
+Type: Feature/Change Request
-PHP Version: 5.2.11
+PHP Version: *
[2014-07-13 02:23 UTC] yohgaki@php.net
[2021-02-12 12:54 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2021-02-12 12:54 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 23:00:01 2025 UTC |
Description: ------------ Adding illegal characters to a text node when saved as XML are not either converted to NCRs, or stripped. This breaks the XML, causing it to be "not well-formed" when viewed by standards-compliant browsers, like Firefox. Reproduce code: --------------- <?php header ('Content-Type: text/xml'); $document = new DOMDocument ('1.0', 'utf-8'); $element = $document -> createElement ('element'); $text = $document -> createTextNode (''); // Please copy and paste this line directly; it contains special characters that may not display correctly; and are invalid in XML based on the W3C specification. $element -> appendChild ($text); $document -> appendChild ($element); echo $document -> saveXML ( ); Expected result: ---------------- <?xml version="1.0" encoding="utf-8"?> <element/> Actual result: -------------- <?xml version="1.0" encoding="utf-8"?> <element></element>