#47117 [Fbk->Bgs]: wrong XML parse, loss chars

From: Date: Thu, 22 Jan 2009 14:06:55 +0000
Subject: #47117 [Fbk->Bgs]: wrong XML parse, loss chars
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133153@lists.php.net to get a copy of this message
 ID:               47117
 Updated by:       rrichards@php.net
 Reported By:      dir at melbis dot com
-Status:           Feedback
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: FreeBSD 7.1
 PHP Version:      5.2.8
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

duplicate of bug #45996


Previous Comments:
------------------------------------------------------------------------

[2009-01-22 13:29:27] dm at vfh dot de

I solved the problem by downgrading libxml2 from 2.7.2 to 2.6.32.
See also: http://bugs.php.net/bug.php?id=45996

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

[2009-01-15 19:23:48] jani@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



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

[2009-01-15 17:24:28] dir at melbis dot com

Description:
------------
When parsing XML, chars "<" and ">" was gone...
For sample, Tag has "&lt;STRONG&gt;", but outside wrong value:
"STRONG", must be "<STRONG>"

Reproduce code:
---------------
$data = '<MELBISSHOP Version="5.4.0"><DO
KeyValues="1242"><descr>&lt;STRONG&gt;</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 this bug report at http://bugs.php.net/?id=47117&edit=1



Thread (4 messages)

« previous php.bugs (#133153) next »