Bug #55531 [Opn]: Vertical tabs ignored by XMLWriter

From: Date: Mon, 29 Aug 2011 16:01:35 +0000
Subject: Bug #55531 [Opn]: Vertical tabs ignored by XMLWriter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-163108@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55531&edit=1

 ID:                 55531
 Updated by:         pajoye@php.net
 Reported by:        brianlmoon@php.net
 Summary:            Vertical tabs ignored by XMLWriter
 Status:             Open
 Type:               Bug
 Package:            XML related
 Operating System:   Linux
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

XML 1.0 this character is not valid. Not sure if we should allow it, .net 2.x 
allows them optionally using settings.CheckCharacters = true;.

But that|s something libxml deals with, PHP's xml extensions only rely on it to 
parse input or generate data.


Previous Comments:
------------------------------------------------------------------------
[2011-08-29 15:52:18] 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.


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55531&edit=1


Thread (4 messages)

« previous php.bugs (#163108) next »