#37289 [Fbk->Bgs]: wddx_deserialize fail with iso-8859-1
| From: | chregu@php.net | Date: | Wed, 03 May 2006 13:23:43 +0000 |
| Subject: | #37289 [Fbk->Bgs]: wddx_deserialize fail with iso-8859-1 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-96543@lists.php.net to get a copy of this message | ||
ID: 37289
Updated by: chregu@php.net
Reported By: philippe dot louys at arc-intl dot com
-Status: Feedback
+Status: Bogus
Bug Type: XML related
Operating System: HP-UX 11
PHP Version: 5.1.3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Please read the docs. text nodes are nod guaranteed to come in
one callback.
Previous Comments:
------------------------------------------------------------------------
[2006-05-03 13:22:47] iliaa@php.net
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
------------------------------------------------------------------------
[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