Fixed parent class does not exists in Hyperf\GrpcServer\CoreMiddleware. (#1572)

示例代码: https://github.com/nfangxu/hyperf-demo/blob/bug-grpc-di/app/Controller/HiController.php
This commit is contained in:
nfangxu 2020-04-16 12:25:06 +08:00 committed by GitHub
parent 170ea477fb
commit 276200832a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,7 +130,7 @@ class CoreMiddleware extends HttpCoreMiddleware
$ref = $definition['ref'];
$class = ReflectionManager::reflectClass($ref);
$parentClass = $class->getParentClass();
if ($parentClass->getName() === ProtobufMessage::class) {
if ($parentClass && $parentClass->getName() === ProtobufMessage::class) {
$request = $this->request();
$stream = $request->getBody();
return Parser::deserializeMessage([$class->getName(), null], $stream->getContents());