From: roger4a45 at yahoo dot es
Operating system: Windows XP
PHP version: 5.0.2
PHP Bug Type: DOM XML related
Bug description: saveXML / XSLT TransformToXML bug?
Description:
------------
ref 1:
I try to build a XML using DOM extensions and then I want to output this
one by using XSLT extensions. My XML is created dinamicaly using
createElements / appendChilds as i will show below. If I use specials
chars like �� �� i can see a warning when i make and saveXML from
DOMDocument.
echo $xmlDOMDoc->saveXML()
Warning: output conversion failed due to conv error in d:\archivos de
programa\apache group\Apache\htdocs\newnovoprint\test\v2.php on line 122
Warning: Bytes: 0xE9 0x73 0x20 0x50 in d:\archivos de programa\apache
group\Apache\htdocs\newnovoprint\test\v2.php on line 122
Andres Poluk Andr
ref2:
If I try to use XSLT extensions when i make a TransformToXML() output is
wrong. Andr��s is output as a Andr��.
ref3:
I check documentation and i didn't find any information about that
problem.
If I load same XML from a file and i use XSLT extensions that result is
OK.
In code example i put third easy examples i build to explain this possible
bug.
Reproduce code:
---------------
XML I want to make (tested) known as v1.xml in third source.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<TEST>
<NAME>Andr��s Polim</NAME>
</TEST>
XSL I use v1.xsl (tested)
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40">
<xsl:template match="TEST">
<xsl:value-of select="NAME"/><BR/>
</xsl:template>
</xsl:stylesheet>
First Code ref: 1
<?php
$xml = new DOMDocument('1.0', 'iso-8859-1');
$root = $xml->CreateElement("TEST");
$child = $xml->CreateElement("NAME","Andr��s Poluk");
$root->appendChild($child);
$xml->appendChild($root);
echo $xml->saveXML(); // <----- Error
?>
Second Code ref: 2
<?php
$xml = new DOMDocument('1.0', 'iso-8859-1');
$xsl = new DOMDocument;
$xsl->load('v1.xsl');
$proc = new XSLTProcessor;
$root = $xml->CreateElement("TEST");
$child = $xml->CreateElement("NAME","Andr��s Poluk");
$root->appendChild($child);
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
?>
Third code ref: 3 (This one works ok)
<?php
$xml = new DOMDocument;
$xsl = new DOMDocument;
$proc = new XSLTProcessor;
$xml->load('v1.xml');
$xsl->load('V1.xsl');
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
?>
Expected result:
----------------
ref1,ref2,ref3:
Andr��s Poluk (A simple text)
or
<?xml version="1.0" encoding="ISO-8859-1"?>
Andr��s Poluk
Actual result:
--------------
ref1:
Warning: Bytes: 0xE9 0x73 0x20 0x50 in d:\archivos de programa\apache
group\Apache\htdocs\newnovoprint\test\v2.php on line 122
Andres Poluk Andr
ref2:
Andr��. Poluk
ref3:
Andr��s Poluk
--
Edit bug report at http://bugs.php.net/?id=32078&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32078&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32078&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32078&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32078&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32078&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32078&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32078&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32078&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32078&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32078&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32078&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32078&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32078&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32078&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32078&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32078&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32078&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32078&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32078&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32078&r=mysqlcfg