diff options
Diffstat (limited to 'php/src/Google/Protobuf/Internal')
-rw-r--r-- | php/src/Google/Protobuf/Internal/DescriptorPool.php | 2 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/Message.php | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/php/src/Google/Protobuf/Internal/DescriptorPool.php b/php/src/Google/Protobuf/Internal/DescriptorPool.php index 23b304ac..1ef403cf 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorPool.php +++ b/php/src/Google/Protobuf/Internal/DescriptorPool.php @@ -58,7 +58,7 @@ class DescriptorPool public function internalAddGeneratedFile($data) { $files = new FileDescriptorSet(); - $files->decode($data); + $files->mergeFromString($data); $file = FileDescriptor::buildFromProto($files->getFile()[0]); foreach ($file->getMessageType() as &$desc) { diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php index 17ef8536..ca4fde02 100644 --- a/php/src/Google/Protobuf/Internal/Message.php +++ b/php/src/Google/Protobuf/Internal/Message.php @@ -562,12 +562,14 @@ class Message * Parses a protocol buffer contained in a string. * * This function takes a string in the (non-human-readable) binary wire - * format, matching the encoding output by encode(). + * format, matching the encoding output by serializeToString(). + * See mergeFrom() for merging behavior, if the field is already set in the + * specified message. * * @param string $data Binary protobuf data. * @return bool Return true on success. */ - public function decode($data) + public function mergeFromString($data) { $input = new InputStream($data); $this->parseFromStream($input); @@ -714,7 +716,7 @@ class Message * Serialize the message to string. * @return string Serialized binary protobuf data. */ - public function encode() + public function serializeToString() { $output = new OutputStream($this->byteSize()); $this->serializeToStream($output); |