diff options
Diffstat (limited to 'php/src/Google')
-rw-r--r-- | php/src/Google/Protobuf/Any.php | 7 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/Message.php | 20 |
2 files changed, 18 insertions, 9 deletions
diff --git a/php/src/Google/Protobuf/Any.php b/php/src/Google/Protobuf/Any.php index 91ba4bd5..f027b05d 100644 --- a/php/src/Google/Protobuf/Any.php +++ b/php/src/Google/Protobuf/Any.php @@ -4,7 +4,6 @@ namespace Google\Protobuf; -use Google\Protobuf\Internal\DescriptorPool; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; use Google\Protobuf\Internal\Message; @@ -217,7 +216,7 @@ class Any extends \Google\Protobuf\Internal\Message substr($this->type_url, $url_prifix_len); // Create message according to fully qualified name. - $pool = DescriptorPool::getGeneratedPool(); + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); $desc = $pool->getDescriptorByProtoName( ".".$fully_qualifed_name); if (is_null($desc)) { throw new \Exception("Class ".$fully_qualifed_name @@ -248,7 +247,7 @@ class Any extends \Google\Protobuf\Internal\Message $this->value = $msg->serializeToString(); // Set type url. - $pool = DescriptorPool::getGeneratedPool(); + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); $desc = $pool->getDescriptorByClassName(get_class($msg)); $fully_qualifed_name = $desc->getFullName(); $this->type_url = GPBUtil::TYPE_URL_PREFIX.substr( @@ -262,7 +261,7 @@ class Any extends \Google\Protobuf\Internal\Message */ public function is($klass) { - $pool = DescriptorPool::getGeneratedPool(); + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); $desc = $pool->getDescriptorByClassName($klass); $fully_qualifed_name = $desc->getFullName(); $type_url = GPBUtil::TYPE_URL_PREFIX.substr( diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php index 9785be30..26d20575 100644 --- a/php/src/Google/Protobuf/Internal/Message.php +++ b/php/src/Google/Protobuf/Internal/Message.php @@ -577,6 +577,15 @@ class Message } /** + * Clear all unknown fields previously parsed. + * @return null. + */ + public function discardUnknownFields() + { + $this->unknown = ""; + } + + /** * Merges the contents of the specified message into current message. * * This method merges the contents of the specified message into the @@ -833,6 +842,8 @@ class Message } return $value; case GPBType::INT32: + case GPBType::SINT32: + case GPBType::SFIXED32: if (is_null($value)) { return $this->defaultValue($field); } @@ -850,6 +861,7 @@ class Message } return $value; case GPBType::UINT32: + case GPBType::FIXED32: if (is_null($value)) { return $this->defaultValue($field); } @@ -863,6 +875,8 @@ class Message } return $value; case GPBType::INT64: + case GPBType::SINT64: + case GPBType::SFIXED64: if (is_null($value)) { return $this->defaultValue($field); } @@ -880,6 +894,7 @@ class Message } return $value; case GPBType::UINT64: + case GPBType::FIXED64: if (is_null($value)) { return $this->defaultValue($field); } @@ -895,11 +910,6 @@ class Message $value = bcsub($value, "18446744073709551616"); } return $value; - case GPBType::FIXED64: - if (is_null($value)) { - return $this->defaultValue($field); - } - return $value; default: return $value; } |