diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-11-04 09:33:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-04 09:33:56 -0700 |
commit | 2df472690ec878ff75a2ccea0c7ff6df0ff69ee3 (patch) | |
tree | 560036eac52891238eb3b805c90f6099bc7801ea /php/src/Google/Protobuf/Any.php | |
parent | cbe250591fca9d2e776776be065a72c5550a5556 (diff) |
Fix php well known type conformance tests (#3828) (#3840)
* Fix php well known type conformance tests
* Properly generate code for test.proto
* Provide GPBMetadata files in c extensions for generated files to import.
* Remove unnecessary test
* Clean up code
* Add declaration for initOnce.
* Refactoring
Diffstat (limited to 'php/src/Google/Protobuf/Any.php')
-rw-r--r-- | php/src/Google/Protobuf/Any.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/php/src/Google/Protobuf/Any.php b/php/src/Google/Protobuf/Any.php index a39c4e6a..91ba4bd5 100644 --- a/php/src/Google/Protobuf/Any.php +++ b/php/src/Google/Protobuf/Any.php @@ -207,9 +207,9 @@ class Any extends \Google\Protobuf\Internal\Message public function unpack() { // Get fully qualifed name from type url. - $url_prifix_len = strlen(Any::TYPE_URL_PREFIX); + $url_prifix_len = strlen(GPBUtil::TYPE_URL_PREFIX); if (substr($this->type_url, 0, $url_prifix_len) != - Any::TYPE_URL_PREFIX) { + GPBUtil::TYPE_URL_PREFIX) { throw new \Exception( "Type url needs to be type.googleapis.com/fully-qulified"); } @@ -251,7 +251,7 @@ class Any extends \Google\Protobuf\Internal\Message $pool = DescriptorPool::getGeneratedPool(); $desc = $pool->getDescriptorByClassName(get_class($msg)); $fully_qualifed_name = $desc->getFullName(); - $this->type_url = Any::TYPE_URL_PREFIX.substr( + $this->type_url = GPBUtil::TYPE_URL_PREFIX.substr( $fully_qualifed_name, 1, strlen($fully_qualifed_name)); } @@ -265,7 +265,7 @@ class Any extends \Google\Protobuf\Internal\Message $pool = DescriptorPool::getGeneratedPool(); $desc = $pool->getDescriptorByClassName($klass); $fully_qualifed_name = $desc->getFullName(); - $type_url = Any::TYPE_URL_PREFIX.substr( + $type_url = GPBUtil::TYPE_URL_PREFIX.substr( $fully_qualifed_name, 1, strlen($fully_qualifed_name)); return $this->type_url === $type_url; } |