msgpack / msgpack-php

msgpack.org[PHP]
BSD 3-Clause "New" or "Revised" License
774 stars 120 forks source link

$unpacker->execute() bug #107

Closed ghost closed 4 years ago

ghost commented 7 years ago
$data1 = file_get_contents("/tmp/msgpack1");
$data2 = file_get_contents("/tmp/msgpack2");
$unpacker = new \MessagePackUnpacker(false);
$unpacker->feed($data1);
if($unpacker->execute()) //return TRUE
{
    $unpacked = $unpacker->data();
    print_r($unpacked); //here we have partial data, sometime we have Exception, sometime other errors
}

$unpacker->reset();
$unpacker = new \MessagePackUnpacker(false);
$unpacker->feed($data1 . $data2);
if($unpacker->execute()) //return TRUE as expected
{
    $unpacked = $unpacker->data();
    print_r($unpacked); //all is OK
}

$unpacker->reset();

In ZIP i have 1 array with 100 strings MsgPacked in ObjC and saved as 2 files to test Streaming Unpacking

files: msgpack.zip

#: php -v
PHP 7.0.13 (cli) (built: Nov 11 2016 17:35:21) ( NTS )