From: pog at grumpf dot net
Operating system: FreeBSD 4.10-RC
PHP version: 4.3.6
PHP Bug Type: DOM XML related
Bug description: error/warning using dump_mem() and ISO-8859-1
Description:
------------
I got warning/error using dump_mem(true,'ISO-8859-1') and accentuation
put a '�/�/�/�' or any accent char and press 'go'
that crash converter
$xmlDoc->dump_mem(true, 'ISO-8859-1');
Reproduce code:
---------------
<?
if (!isset ($submit)) { ?>
<form action="<?php echo $SCRIPT_NAME ?>" method="POST">
champ1 : <input type="text" name="txt1" /><br/>
champ2 : <input type="text" name="txt2" /><br/>
champ3 : <input type="text" name="txt3" /><br/>
<input type="submit" name="submit" value="go" /><br/>
</form>
<?
} else {
$xmlDoc = domxml_new_doc('1.0');
$root = $xmlDoc->add_root("root");
while(list($key, $value) = each($HTTP_POST_VARS)) {
$nodeName = $root->new_child($key, $value);
};
echo $xmlDoc->dump_mem(true, 'ISO-8859-1');
};
?>
Expected result:
----------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<txt1>�</txt1>
<txt2></txt2>
<txt3></txt3>
<submit>go</submit>
</root>
Actual result:
--------------
Warning: dump_mem(): output conversion failed due to conv error in
/usr/home/pog/public_html/test/form2.php on line 17
Warning: dump_mem(): Bytes: 0xE9 0x3C 0x2F 0x74 in
/usr/home/pog/public_html/test/form2.php on line 17
Warning: dump_mem(): encoder error in
/usr/home/pog/public_html/test/form2.php on line 17
if you look at html source:
<br />
<b>Warning</b>: dump_mem(): output conversion failed due to conv error
in <b>/usr/home/pog/public_html/test/form2.php</b> on line <b>17</b><br
/>
<br />
<b>Warning</b>: dump_mem(): Bytes: 0xE9 0x3C 0x2F 0x74
in <b>/usr/home/pog/public_html/test/form2.php</b> on line <b>17</b><br
/>
<br />
<b>Warning</b>: dump_mem(): encoder error in
<b>/usr/home/pog/public_html/test/form2.php</b> on line <b>17</b><br />
<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<txt1>
--
Edit bug report at http://bugs.php.net/?id=28383&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28383&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28383&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28383&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28383&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28383&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28383&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28383&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28383&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28383&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28383&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28383&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28383&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28383&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28383&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28383&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28383&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28383&r=float