-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
I'm struggling with the bytes or utf-8 problem, the value of nick attribute is "nihao_1", while to array it changes to "1", I can't find out the reason
PHP version is 5.4
here's my codes
message server_user_account_t{
required string source_number = 1;
required bytes nick = 2;
required uint32 server_id = 3;
optional uint32 sex = 4;
}
$body = server_user_account_t::parseFromString($str);
var_dump($body);
the print message is
object(hy\protobuf\server_user_account_t)#25 (4) {
["source_number":protected]=>
string(9) "757559966"
["nick":protected]=>
string(7) "nihao_1"
["server_id":protected]=>
string(1) "1"
["sex":protected]=>
NULL
}
$body = $body->toArray();
var_dump($body);
the print message is
array(3)` {
["source_number"]=>
string(9) "757559966"
["nick"]=>
int(0)
["server_id"]=>
int(1)
}
Metadata
Metadata
Assignees
Labels
No labels