From: dir at melbis dot com
Operating system: FreeBSD 7.1
PHP version: 5.2.8
PHP Bug Type: DOM XML related
Bug description: wrong XML parse, loss chars
Description:
------------
When parsing XML, chars "<" and ">" was gone...
For sample, Tag has "<STRONG>", but outside wrong value: "STRONG",
must be "<STRONG>"
Reproduce code:
---------------
$data = '<MELBISSHOP Version="5.4.0"><DO
KeyValues="1242"><descr><STRONG></descr></DO></MELBISSHOP>';
$xml_parser = xml_parser_create('UTF-8');
xml_set_element_handler($xml_parser, "start_xml_tag", "end_xml_tag");
xml_set_character_data_handler($xml_parser, "xml_tag");
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, FALSE);
xml_parse($xml_parser, $data, true);
function start_xml_tag($mParser, $mName, $mAttrs) {
global $gDoValues, $gCurrentTagName;
$gCurrentTagName = $mName;
if ( $mName != 'DO' ) { $gDoValues[$gCurrentTagName] = ''; } else {
$gDoValues = array(); } }
function xml_tag($mParser, $mData) {
global $gDoValues, $gCurrentTagName;
$gDoValues[$gCurrentTagName] .= $mData;}
function end_xml_tag($mParser, $mName) {
global $gDoValues, $gData;
if ($mName == 'DO') { print_r($gDoValues); }}
Expected result:
----------------
Array
(
[descr] => <STRONG>
)
Actual result:
--------------
Array
(
[descr] => STRONG
)
--
Edit bug report at http://bugs.php.net/?id=47117&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47117&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47117&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47117&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47117&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47117&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47117&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47117&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47117&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47117&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47117&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47117&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47117&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47117&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47117&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47117&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47117&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47117&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47117&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47117&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47117&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47117&r=mysqlcfg