Re: [PHP-DEV] feedback on PHP's WDDX

2002-09-27 Thread Andrei Zmievski

On Fri, 27 Sep 2002, Wez Furlong wrote:
> Is that meant to be a compliment?? :-)

God, no.

-Andrei   http://www.gravitonic.com/
* How would this sentence be different if Pi was equal to three? *

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




Re: [PHP-DEV] feedback on PHP's WDDX

2002-09-27 Thread Wez Furlong

On 27/09/02, "Andrei Zmievski" <[EMAIL PROTECTED]> wrote:
> May you watch Battlefield: Earth 10 times in a row.

Is that meant to be a compliment?? :-)

--Wez.


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




Re: [PHP-DEV] feedback on PHP's WDDX

2002-09-27 Thread Andrei Zmievski

On Fri, 27 Sep 2002, Jan Lehnardt wrote:
> what about wddx_serialize($complex_var, array( 
>   WDDX_EMPTY,
>   ...
>   WDDX_HASH => array(
>   
>WDDX_STRING=>WDDX_STRING,
>   
>WDDX_STRING=>WDDX_STRING)
>   ),
>   WDDX_BINARY
>   );
> It just came to my mind, I haven't thought that through.

May you watch Battlefield: Earth 10 times in a row.

-Andrei   http://www.gravitonic.com/

Give a man a fish; you have fed him for today.  Teach a man to fish;
and you can sell him fishing equipment.  
-Author unknown

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




Re: [PHP-DEV] feedback on PHP's WDDX

2002-09-27 Thread Jan Lehnardt

Hi,
On Fri, Sep 27, 2002 at 11:15:59PM +0800, Jimmy wrote:
> 
> $complex_var = array (
>0 => 'nothing',
>   'MyOS' => array('linux', 'win32', 'BSDI'),  // normal array
>   'hash' => array('key' => 'val',
>   'key2' => 'val' ),   //assoc array
>   'file' => "contain unicode char, so I want binary"
> )
> 
> wddx_serialize($complex_var, WDDX_BINARY);
> wddx_serialize($complex_var, WDDX_ARRAY);
> wddx_serialize($complex_var, WDDX_HASH);
> // what will happen if user call the function with those param?
what about wddx_serialize($complex_var, array( 
WDDX_EMPTY,
...
WDDX_HASH => array(

WDDX_STRING=>WDDX_STRING,

WDDX_STRING=>WDDX_STRING)
),
WDDX_BINARY
);
It just came to my mind, I haven't thought that through.

Jan
--- 
Q: Thank Jan? A: http://geschenke.an.dasmoped.net/
Got an old and spare laptop? Please send me a mail.
Key7BCC EB86 8313 DDA9 25DF  
Fingerprint1805 ECA5 BCB7 BB96 56B0

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




Re: [PHP-DEV] feedback on PHP's WDDX

2002-09-27 Thread Jimmy

Hi Andrei,

> 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.

Yup, I don't think this can be implemented into current wddx
function, due to the interface of the functions as you said,
so I think you need to introduce a new function.

There's another good reason to justify the need of new function:
because you might want to limit the function to accept only
"single value" variable, which is not compatible with all
current functions.

What I mean with "single value" variable is, the variable shouldn't
have a complex "nested structure", because it could lead to ambiguity.

For example:

$complex_var = array (
   0 => 'nothing',
  'MyOS' => array('linux', 'win32', 'BSDI'),  // normal array
  'hash' => array('key' => 'val',
  'key2' => 'val' ),   //assoc array
  'file' => "contain unicode char, so I want binary"
)

wddx_serialize($complex_var, WDDX_BINARY);
wddx_serialize($complex_var, WDDX_ARRAY);
wddx_serialize($complex_var, WDDX_HASH);
// what will happen if user call the function with those param?


Well, maybe this is not a good example, because actually I havent
really thought thoroughly whether this can really lead to ambiguity.
I just want to raise this issue, because I think this could be the
hardest part in implementing the feature.

Regards,

--
Jimmy

They asked me "upgrade the NT server", so I installed UNIX


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




Re: [PHP-DEV] feedback on PHP's WDDX

2002-09-27 Thread Andrei Zmievski

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 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] feedback on PHP's WDDX

2002-09-26 Thread Jan Lehnardt

Hi,
can you please file a bugreport on bugs.php.net and assign it to me (cvs id is
jan). I'll look into this.> 

Jan
-- 
Q: Thank Jan? A: http://geschenke.an.dasmoped.net/
Got an old and spare laptop? Please send me a mail.
Key7BCC EB86 8313 DDA9 25DF  
Fingerprint1805 ECA5 BCB7 BB96 56B0

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




[PHP-DEV] feedback on PHP's WDDX

2002-09-26 Thread Jimmy

Hi,

I am using PHP's WDDX and find it very useful, but that's only if I
use it to exchange data between PHP program. Once I have to exchange
the data with other languange I begin to face problem after problem,
mostly because of the way PHP's WDDX interpret the variable type.

The solution for this is, instead of auto-detecting the type of a var,
PHP's WDDX should allow the user to explicitly specify the type they
want the vars to be encoded as.

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.


Regards,
   
--
Jimmy

Your mind is like parachute. It works best when it is open.


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