From dd5190980b8a9205eaf292f0cd947c3657daaeb1 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Mon, 21 Aug 2017 13:39:15 -0700 Subject: Use message name as defined in php runtime. --- php/src/Google/Protobuf/Internal/GPBUtil.php | 2 +- php/src/Google/Protobuf/Internal/Message.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'php/src') diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php index 6fe36068..84e8ecf0 100644 --- a/php/src/Google/Protobuf/Internal/GPBUtil.php +++ b/php/src/Google/Protobuf/Internal/GPBUtil.php @@ -270,7 +270,7 @@ class GPBUtil $name, $file_proto) { - $classname = implode('_', array_map('ucwords', explode('.', $name))); + $classname = implode('_', explode('.', $name)); return static::getClassNamePrefix($classname, $file_proto) . $classname; } diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php index e1009f2f..8886e61a 100644 --- a/php/src/Google/Protobuf/Internal/Message.php +++ b/php/src/Google/Protobuf/Internal/Message.php @@ -76,6 +76,9 @@ class Message } $pool = DescriptorPool::getGeneratedPool(); $this->desc = $pool->getDescriptorByClassName(get_class($this)); + if (is_null($this->desc)) { + user_error(get_class($this) . "is not found in descriptor pool."); + } foreach ($this->desc->getField() as $field) { $setter = $field->getSetter(); if ($field->isMap()) { -- cgit v1.2.3