ID: 41800
User updated by: a dot anpilogov at gmail dot com
Reported By: a dot anpilogov at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: *XML functions
Operating System: FreeBSD
PHP Version: 5.2.3
New Comment:
<?php
$xw = new XMLWriter();
$xw->openMemory();
$xw->startDocument('1.0', 'UTF-8');
$xw->writeElement('root', "\x04\xA0");
$xw->endDocument();
header('Content-type: application/xml');
print $xw->outputMemory(true);
?>
Output will be an invalid XML.
Another example:
<?php
$xw = new XMLWriter();
$xw->openMemory();
$xw->startDocument('1.0', 'ISO-8559-1');
$xw->writeElement('root', "\x04\xA0");
$xw->endDocument();
header('Content-type: application/xml');
print $xw->outputMemory(true);
?>
Warning: XMLWriter::startDocument() [function.XMLWriter-startDocument]:
xmlTextWriterStartDocument : out of memory!
Previous Comments:
------------------------------------------------------------------------
[2007-06-25 14:26:17] [EMAIL PROTECTED]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2007-06-25 13:08:10] a dot anpilogov at gmail dot com
Description:
------------
It is possible to create invalid XML file using XMLwriter. In my case,
the first symbol of Unicode text was 00 13, and XMLWriter just put it
out, so I had to call preg_replace('/^.{1}/us', '', $str) to make valid
UTF-8 string, than pass it to XMLWriter.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41800&edit=1