ID: 38901 Updated by: [EMAIL PROTECTED] Reported By: grzegorz dot nosek at netart dot pl -Status: Open +Status: Feedback Bug Type: WDDX related Operating System: Linux PHP Version: 5.1.6 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2006-09-20 13:46:02] 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. Up to this point, it's a duplicate of #38900. However, PHP5 has another bug with variable names (e.g. hash keys) containing UTF8 characters. It seems that the var name is converted down from UTF8 to ISO-8859-1, yielding question marks instead of characters outside latin1. Another hackish patch (whitespace-mutilated): --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -814,10 +814,7 @@ static void php_wddx_push_element(void * if (atts) for (i = 0; atts[i]; i++) { if (!strcmp(atts[i], EL_NAME) && atts[++i] && atts[i][0]) { - char *decoded; - int decoded_len; - decoded = xml_utf8_decode(atts[i], strlen(atts[i]), &decoded_len, "ISO-8859-1"); - stack->varname = decoded; + stack->varname = estrndup(atts[i], strlen(atts[i])); break; } } @@ -1057,7 +1054,12 @@ static void php_wddx_process_data(void * 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"); + if (len > 1) { + decoded = xml_utf8_decode(s, len, &decoded_len, "ISO-8859-1"); + } else { + decoded = estrndup(s, len); + decoded_len = len; + } Reproduce code: --------------- See http://bugs.php.net/bug.php?id=38900 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38901&edit=1