Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixbug: when call json_encode or toArray, fields of BYTES are encoded to zero. #51

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

bryceliu
Copy link

When call json_encode or toArray, fields of BYTES are encoded to zero.


Message definition:

message Person                 
{
    required bytes name = 1;   
    required uint32 age = 2;   
}

PHP test code:

require 'person.proto.php';
$person = new Person();
$person->setName('bryce');
$person->setAge(18);
var_dump($person->toArray());
var_dump(json_encode($person));

PHP output:

array(2) {
  ["name"]=>
  int(0)
  ["age"]=>
  int(18)
}
string(19) "{"name":0,"age":18}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants