aboutsummaryrefslogtreecommitdiff
path: root/php/src
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2017-09-20 22:59:13 -0700
committerGitHub <noreply@github.com>2017-09-20 22:59:13 -0700
commit2b0ee3fdf62577708eea74db3c31853782ae4efe (patch)
treeadd8e220258a2e7f6d3595ce7ed9beb39e2f1f5b /php/src
parenteade82c8365e1680deb22260d9739928b0492063 (diff)
downloadprotobuf-2b0ee3fdf62577708eea74db3c31853782ae4efe.tar.gz
protobuf-2b0ee3fdf62577708eea74db3c31853782ae4efe.tar.bz2
protobuf-2b0ee3fdf62577708eea74db3c31853782ae4efe.zip
Add $ before url_prefix_len to make it a variable. (#3668)
* Add $ before url_prefix_len to make it a variable. * Remove unnecessary string length check * Remove useless $type_url_len
Diffstat (limited to 'php/src')
-rw-r--r--php/src/Google/Protobuf/Any.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/php/src/Google/Protobuf/Any.php b/php/src/Google/Protobuf/Any.php
index a8ce4316..a39c4e6a 100644
--- a/php/src/Google/Protobuf/Any.php
+++ b/php/src/Google/Protobuf/Any.php
@@ -207,16 +207,14 @@ class Any extends \Google\Protobuf\Internal\Message
public function unpack()
{
// Get fully qualifed name from type url.
- $type_url_len = strlen($this->type_url);
$url_prifix_len = strlen(Any::TYPE_URL_PREFIX);
- if ($type_url_len < url_prifix_len ||
- substr($this->type_url, 0, $url_prifix_len) !=
+ if (substr($this->type_url, 0, $url_prifix_len) !=
Any::TYPE_URL_PREFIX) {
throw new \Exception(
"Type url needs to be type.googleapis.com/fully-qulified");
}
$fully_qualifed_name =
- substr($this->type_url, $url_prifix_len, $type_url_len);
+ substr($this->type_url, $url_prifix_len);
// Create message according to fully qualified name.
$pool = DescriptorPool::getGeneratedPool();