aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/src/Google/Protobuf/Internal/DescriptorPool.php
diff options
context:
space:
mode:
authorGravatar Paul Yang <TeBoring@users.noreply.github.com>2017-09-22 14:08:01 -0700
committerGravatar GitHub <noreply@github.com>2017-09-22 14:08:01 -0700
commitae55fd2cc52849004de21a7e26aed7bfe393eaed (patch)
treefd4abff8b105123876b58748606f40dca16582e0 /php/src/Google/Protobuf/Internal/DescriptorPool.php
parentc20440222afe368b2ddb1f842d469fdbe10f5389 (diff)
Enforce all error report for php tests. (#3670)
* Enforce all error report for php tests. * Import vendor/autoload.php in tests/bootstrap_phpunit.php
Diffstat (limited to 'php/src/Google/Protobuf/Internal/DescriptorPool.php')
-rw-r--r--php/src/Google/Protobuf/Internal/DescriptorPool.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/php/src/Google/Protobuf/Internal/DescriptorPool.php b/php/src/Google/Protobuf/Internal/DescriptorPool.php
index 65d1a884..304c1615 100644
--- a/php/src/Google/Protobuf/Internal/DescriptorPool.php
+++ b/php/src/Google/Protobuf/Internal/DescriptorPool.php
@@ -109,18 +109,30 @@ class DescriptorPool
public function getDescriptorByClassName($klass)
{
- return $this->class_to_desc[$klass];
+ if (isset($this->class_to_desc[$klass])) {
+ return $this->class_to_desc[$klass];
+ } else {
+ return null;
+ }
}
public function getEnumDescriptorByClassName($klass)
{
- return $this->class_to_enum_desc[$klass];
+ if (isset($this->class_to_enum_desc[$klass])) {
+ return $this->class_to_enum_desc[$klass];
+ } else {
+ return null;
+ }
}
public function getDescriptorByProtoName($proto)
{
- $klass = $this->proto_to_class[$proto];
- return $this->class_to_desc[$klass];
+ if (isset($this->proto_to_class[$proto])) {
+ $klass = $this->proto_to_class[$proto];
+ return $this->class_to_desc[$klass];
+ } else {
+ return null;
+ }
}
public function getEnumDescriptorByProtoName($proto)