From:             JeanLuc dot TRIPLET at yahoo dot fr
Operating system: Windows
PHP version:      5.2.6
PHP Bug Type:     WDDX related
Bug description:  wddx_add_vars doesn't convert var names to UTF8

Description:
------------
wddx_add_vars() correctly converts values to UTF-8, but doesn't convert
var names to UTF-8, so wddx_deserialize() return an empty array as XML
packet contains var names with accent.

below is a script showing that string values are converted to UTF-8 by
wddx_add_vars, but var names are not converted. It also show that
wddx_deserialize() works fine when input packet contains UTF_8 encoded var
names manually, but doesn't work when var names are let accentuated by
wddx_add_vars().

Could you please, modify wddx_add_vars, to UTF_8 encode var names as
already done for string values ?

Thank for your help.


Reproduce code:
---------------
<?php
 
// If varname is ascii, unserialize is OK //
$packet_id = wddx_packet_start("PHP");
$varname = "value é";
      wddx_add_vars($packet_id,"varname");
      $packet = wddx_packet_end($packet_id);
var_dump ($packet);
echo "\n\n";
$result = wddx_deserialize($packet);
var_dump ($result);

// If varname is non_ascii, unserialize return array(0) {} //
$packet_id = wddx_packet_start("PHP");
$varnameé = "value é";
      wddx_add_vars($packet_id,"varnameé");
      $packet = wddx_packet_end($packet_id);
var_dump ($packet);
$result = wddx_deserialize($packet);
var_dump ($result);

// If packet contains non_ascii UTF-8 encoded varname, unserialize is OK
//
$packet = "<wddxPacket
version='1.0'><header><comment>PHP</comment></header><data><struct><var
name='varnameé'><string>value
é</string></var></struct></data></wddxPacket>";
var_dump ($packet);
$result = wddx_deserialize($packet);
var_dump ($result);

?>

Expected result:
----------------
string(159) "value é"
array(1) { ["varname"]=> string(7) "value é" }
string(160) "value é"
array(1) { ["varnameé"]=> string(7) "value é" }
string(161) "value é"
array(1) { ["varnameé"]=> string(7) "value é" }

Actual result:
--------------
string(159) "value é"
array(1) { ["varname"]=> string(7) "value é" }
string(160) "value é"
array(0) { }
string(161) "value é"
array(1) { ["varnameé"]=> string(7) "value é" }

-- 
Edit bug report at http://bugs.php.net/?id=45037&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45037&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45037&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45037&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45037&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45037&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45037&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45037&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45037&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45037&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45037&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45037&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45037&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45037&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45037&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45037&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45037&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45037&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45037&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45037&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45037&r=mysqlcfg

Reply via email to