ID: 37289
Updated by: [EMAIL PROTECTED]
Reported By: philippe dot louys at arc-intl dot com
-Status: Open
+Status: Feedback
Bug Type: XML related
Operating System: HP-UX 11
PHP Version: 5.1.3
New Comment:
It could be a problem with your libxml since when I've tested
your wddx string the deserialize function parsed it properly
creating an erray with key screen and value of
aaabbbéééécccdddeee
Previous Comments:
------------------------------------------------------------------------
[2006-05-03 11:58:56] philippe dot louys at arc-intl dot com
Description:
------------
wddx_deserialize returns NULL when iso-8859-1 encoding is used and
packet contains a non-ascii character (ex : é).
PHP5 is built with libxml.
With PHP4 and EXPAT all is right.
I think the problem come from libxml.
I wrote a script wich call the parser directly and saw that
the callback data function is called once in PHP4 with the entire
string, and twice in PHP5.
The first call is done with the first part of the string, until the
first accented character (excluded).
Second call with the remainder of the string.
Ex : aaaabbbbééééccccddd
PHP4 : data callback function called with aaaabbbbééééccccddd
PHP5 : data callback function called with
aaaabbbb
then a second time with
ééééccccddd
Reproduce code:
---------------
<?php
$data = "<" . "?" . "xml version=\"1.0\" encoding=\"ISO-8859-1\"" . "?"
. ">\n";
$data .= "<data><struct><var
name=\"screen\"><string>aaabbbéééécccdddeee</string></var></struct></data>";
$depth = array();
function beginElement($parser, $name, $attrs)
{
global $depth;
$depth[(int) $parser]++;
}
function endElement($parser, $name)
{
global $depth;
$depth[(int) $parser]--;
}
function getDatas($parser, $data)
{
echo $data . "<br>";
}
$xml_parser = xml_parser_create("ISO-8859-1");
xml_set_element_handler($xml_parser, "beginElement", "endElement");
xml_set_character_data_handler($xml_parser, "getDatas");
if (!xml_parse($xml_parser, $data, TRUE)) {
die(sprintf("XML error : %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
xml_parser_free($xml_parser);
?>
Expected result:
----------------
aaaabbbbééééccccddd
Actual result:
--------------
aaaabbbb
ééééccccddd
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37289&edit=1