kphp
kphp copied to clipboard
Serialization of Message pack with indication of a specific type
The current serialization function independently determines the type of message pack to which the data needs to be brought. In some cases, this functionality is not enough. For example, to work with Tarantool via the Iproto binary protocol, you need to pass a map of the form:
$body = msgpack_serialize([
0x20 => 0x01,
0x01 => 512,
0x11 => 280,
0x12 => \PHP_INT_MAX & 0xffffffff,
0x13 => 0,
0x14 => 0
]);
When serialized, the type of this array in the message pack is fixed array (0x96), and it should be map (0x86). It would be nice to be able to specify the type yourself during serialization, as is done in serialization libraries, for example, in php:
$body = $packer->packMap($value);