On Thu, 26 Sep 2002, Jimmy wrote:
> For example:
> 
> $string = "1";
> wddx_serialize($string, WDDX_INTEGER);
> // var $string will be encoded as integer, instead of string
> 
> $file_name = "contain some unicode char";
> wddx_serialize($file_name, WDDX_BINARY);
> // var $file_name will be encoded as binary, instead of string
> 
> 
> Two good reasons why this should be implemented:
> 
> 1. The main purpose of WDDX is to exchange data between diff lang, and
>    auto-detecting var type will break this purpose.  Moreover, the
>    type-juggling in PHP will make the case worst.
> 
>    For example, consider these two data:
> 
>      array ("2" => "Two", "4" => "Four", "5" => "Five");
>      array ("0" => "Zero", "1" => "One", "2" => "Two");
> 
>    The first one will be interpreted by WDDX as hash (assoc array).
>    But the second one, where the key happen to be a sequence
>    starting from 0, will be interpreted as normal array, not hash.
> 
> 2. If users can specify the type of a variable, then PHP's WDDX can support
>    all type which is defined in WDDX standard.
>    For example binary type. Currently there's no way to create a
>    WDDX packet with binary type, because PHP don't have binary type
>    variable.  There's a workaround to manually base64 the var, but this
>    will require a change at the other end to handle this workaround
>    too, which in some cases is not possible.

I think it's a good idea. The only problem I see is making it work with
all three serialization functions. wddx_serialize_value() is fine, but
wddx_serialize_vars() and wddx_add_vars() take variable number of
arguments, so it's not clear how it would work in those cases.

-Andrei                                       http://www.gravitonic.com/
* Change is the only constant. *

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to