Open bryceliu opened 9 years ago
message Person { required bytes name = 1; required uint32 age = 2; }
require 'person.proto.php'; $person = new Person(); $person->setName('bryce'); $person->setAge(18); var_dump($person->toArray()); var_dump(json_encode($person));
array(2) { ["name"]=> int(0) ["age"]=> int(18) } string(19) "{"name":0,"age":18}"
When call json_encode or toArray, fields of BYTES are encoded to zero.
Message definition:
PHP test code:
PHP output: