#46432 [Asn->Fbk]: xml_parse_into_struct() doesn't return correct data

From: Date: Mon, 03 Nov 2008 17:00:21 +0000
Subject: #46432 [Asn->Fbk]: xml_parse_into_struct() doesn't return correct data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-130567@lists.php.net to get a copy of this message
 ID:               46432
 Updated by:       rrichards@php.net
 Reported By:      jmpons at arenamobile dot com
-Status:           Assigned
+Status:           Feedback
 Bug Type:         XML related
 Operating System: *
 PHP Version:      5.2CVS-2008-10-31
 Assigned To:      rrichards
 New Comment:

Do you happen to be using libxml2 2.7.x when testing with 5.2.6?
If so, this is the same as bug #45996.


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

[2008-10-31 18:04:51] jani@php.net

Tested by compiling with libexpat and it works. When compiled with
libxml it does not work. So it's just incompatibility between libexpat
and libxml. Rob, can you check this out?

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

[2008-10-30 16:33:29] jmpons at arenamobile dot com

Description:
------------
With php 5.2.6, parsing xml code with html inside, return a bad parsed
string...

I have checked it with php 5.2.5 and it works fine...


Reproduce code:
---------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<tree>
<node>bla bla bla &lt;br/&gt; &lt;a
href="http://www.google.com"&gt;url&lt;/a&gt;
blah...</node>
</tree>

<?php
$file = "test.xml";
$data = implode("", file($file));
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $values, $tags);
xml_parser_free($parser);
print_r($values);
?>

Expected result:
----------------
Array
(
    [0] => Array
        (
            [tag] => tree
            [type] => open
            [level] => 1
        )

    [1] => Array
        (
            [tag] => node
            [type] => complete
            [level] => 2
            [value] => bla bla bla <br/><a
href="http://www.google.com">url</a>
blah...
        )

    [2] => Array
        (
            [tag] => tree
            [type] => close
            [level] => 1
        )

)


Actual result:
--------------
Array
(
    [0] => Array
        (
            [tag] => tree
            [type] => open
            [level] => 1
        )

    [1] => Array
        (
            [tag] => node
            [type] => complete
            [level] => 2
            [value] => bla bla bla br/a
href="http://www.google.com"url/a blah...
        )

    [2] => Array
        (
            [tag] => tree
            [type] => close
            [level] => 1
        )

)


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


-- 
Edit this bug report at http://bugs.php.net/?id=46432&edit=1



Thread (5 messages)

« previous php.bugs (#130567) next »