Table of Contents

Value types

The main problem for packets generation is the values types. Wddx supports a range of types including common types also found in PHP (array, struct, string, boolean, number, null, and binary with PHP 6), but also some types specific to Wddx, including dateTime and recordSet.

WDDX types

dateTime

The new DateTime php object could be automatically serialized to the dateTime wddx type.

NB: Wddx is missing a “timezone” in the specs, however other implementations seems to add “+00:00” (depending on the timezone, like DATE_ATOM)

Problems:

Advantages:

recordSet

A recordSet is like a table (ie. a numerically-indexed array containing in each row arrays with always the same columns).

The implementation currently converts everything to arrays.

Binary data

WDDX offers the ability to transfer binary data (base64 encoded). There is currently no way to encode data in this format.

Solutions for PHP <6 includes:

Possibilities

New class approach

Create a new WddxValue class, with a “type” attribute. Casting this class to other types would return values compatible with previous implementation.

The class would implement ArrayAccess, Iterator, etc.. to allow access to array/struct/resultset.

$value = new WddxValue($binary_data, WddxValue::BINARY);

Native types

Problems:

Hybrid solution

Problems:

PHP6 support

Input (XML) string should be UTF-8 encoded. In the case of unicode string, encoding is irrelevant, however for binary string we need to force utf-8 (with UG(utf8_conv))

Input variables/etc were by definition UTF-8, however thanks to PHP 6, we now have a “default charset” for variables. I believe we should use this one, if we are to convert stuff to UTF-8 (ie. not implement “strings” as binary).