|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-08-29 15:52 UTC] brianlmoon@php.net
Description:
------------
When text contains vertical tabs, XMLWriter silently ignores them and generates invalid XML. This is not an issue where the text is invalid UTF-8. It is valid UTF-8 data. Vertical tabs are simply not allowed in XML by rule. I would expect XMLWriter to encode it as it would any other character not allowed in XML. I suspect that
Test script:
---------------
<?php
$xml = new XmlWriter();
$xml->openMemory();
$xml->startDocument('1.0', 'UTF-8');
$xml->writeElement("test", "This data contains a \vvertical tab");
$xml->endElement();
$data = $xml->outputMemory(true);
$sxml = simplexml_load_string($data);
?>
Expected result:
----------------
Either an error or valid XML.
Actual result:
--------------
Invalid XML is silently created. For example, SimpleXML::addchild() throws a warning: SimpleXMLElement::asXML(): xmlEscapeEntities : char out of range when a vertical tab is present and the node is not added.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 17:00:01 2025 UTC |
This issue is fixed as of libxml2 2.9.11: Warning: simplexml_load_string(): Entity: line 2: parser error : PCDATA invalid Char value 11 Warning: simplexml_load_string(): <test>This data contains a vertical tab</test> Warning: simplexml_load_string(): ^