|
@@ -207,16 +207,14 @@ class Any extends \Google\Protobuf\Internal\Message
|
|
public function unpack()
|
|
public function unpack()
|
|
{
|
|
{
|
|
// Get fully qualifed name from type url.
|
|
// Get fully qualifed name from type url.
|
|
- $type_url_len = strlen($this->type_url);
|
|
|
|
$url_prifix_len = strlen(Any::TYPE_URL_PREFIX);
|
|
$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) {
|
|
Any::TYPE_URL_PREFIX) {
|
|
throw new \Exception(
|
|
throw new \Exception(
|
|
"Type url needs to be type.googleapis.com/fully-qulified");
|
|
"Type url needs to be type.googleapis.com/fully-qulified");
|
|
}
|
|
}
|
|
$fully_qualifed_name =
|
|
$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.
|
|
// Create message according to fully qualified name.
|
|
$pool = DescriptorPool::getGeneratedPool();
|
|
$pool = DescriptorPool::getGeneratedPool();
|