mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 02:09:59 +00:00
Update PHP Extension
This commit is contained in:
parent
a97f9081a3
commit
78f542f6c0
71 changed files with 7345 additions and 2108 deletions
9
php/test_streaming.php
Executable file → Normal file
9
php/test_streaming.php
Executable file → Normal file
|
|
@ -4,8 +4,7 @@
|
|||
$msgs = array(pack("C*", 0x93, 0x01, 0x02, 0x03, 0x92), pack("C*", 0x03, 0x09, 0x04));
|
||||
|
||||
// streaming deserialize
|
||||
$unpacker = new MessagePack();
|
||||
$unpacker->initialize();
|
||||
$unpacker = new MessagePackUnpacker();
|
||||
$buffer = "";
|
||||
$nread = 0;
|
||||
|
||||
|
|
@ -13,13 +12,11 @@
|
|||
$buffer = $buffer . $msg;
|
||||
|
||||
while(true){
|
||||
$nread = $unpacker->execute($buffer, $nread);
|
||||
|
||||
if($unpacker->finished()){
|
||||
if($unpacker->execute($buffer, $nread)){
|
||||
$msg = $unpacker->data();
|
||||
var_dump($msg);
|
||||
|
||||
$unpacker->initialize();
|
||||
$unpacker->reset();
|
||||
$buffer = substr($buffer, $nread);
|
||||
$nread = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue