From:             philippe dot louys at arc-intl dot com
Operating system: HP-UX 11
PHP version:      5.1.3
PHP Bug Type:     XML related
Bug description:  wddx_deserialize fail with iso-8859-1

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 bug report at http://bugs.php.net/?id=37289&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37289&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=37289&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37289&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37289&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37289&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37289&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37289&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37289&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37289&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37289&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37289&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37289&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37289&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37289&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37289&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37289&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37289&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37289&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37289&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37289&r=mysqlcfg

Reply via email to