ID: 38900 User updated by: grzegorz dot nosek at netart dot pl Reported By: grzegorz dot nosek at netart dot pl Status: Assigned Bug Type: WDDX related Operating System: Linux PHP Version: 4.4.4 Assigned To: andrei New Comment:
Yes, it's apparently a duplicate, or at least related. The symptoms are certainly similar. Previous Comments: ------------------------------------------------------------------------ [2007-07-11 13:08:30] [EMAIL PROTECTED] See also bug #40080 ------------------------------------------------------------------------ [2006-09-20 13:40:18] grzegorz dot nosek at netart dot pl Description: ------------ wddx gets confused if you try to serialize a string with utf8 characters (like the one below, it contains 'z with dot above', 'o acute', 'l stroke' and 'w' - in case it gets messed up somehow). serialized string will contain <char code='C5'/><char code='BC'/> ... etc, which will get fed into xml_utf8_decode byte by byte (after decoding the hex value), totally wrecking the output. Hackish patch which fixes this (whitespace mangled mercilessly, adjust to taste): --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -1038,8 +1038,13 @@ static void php_wddx_process_data(void * if (!wddx_stack_is_empty(stack) && !stack->done) { wddx_stack_top(stack, (void**)&ent); switch (Z_TYPE_P(ent)) { - case ST_STRING: - decoded = xml_utf8_decode(s, len, &decoded_len, "ISO-8859-1"); + case ST_STRING: + if (len > 1) { + decoded = xml_utf8_decode(s, len, &decoded_len, "ISO-8859-1"); + } else { + decoded = estrndup(s, len); + decoded_len = len; + } if (Z_STRLEN_P(ent->data) == 0) { Z_STRVAL_P(ent->data) = estrndup(decoded, decoded_len); Reproduce code: --------------- --TEST-- wddx_deserialize mangles utf8 characters --SKIPIF-- <?php if (!extension_loaded("wddx")) print "skip"; ?> --FILE-- <?php $zolw = iconv("ISO-8859-2", "UTF-8", "żรณłw"); $in = array ( $zolw => $zolw ); var_dump(array_diff($in, wddx_deserialize(wddx_serialize_value($in)))); ?> --EXPECT-- array(0) { } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38900&edit=1