From 189c09f71ac824a842dde45eace6c6a33a245eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Mar 2021 18:29:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rpc/Service.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Rpc/Service.php b/Rpc/Service.php index f70830c5..8a642a1d 100644 --- a/Rpc/Service.php +++ b/Rpc/Service.php @@ -94,11 +94,12 @@ class Service extends Component */ public static function replace(Request $request, array $service): Request { - if (!is_array($body = $request->params->getBodyAndClear())) { + $body = $request->params->getBodyAndClear(); + if (is_string($body) && is_null($body = Json::decode($body))) { throw new Exception('Protocol format error.'); } if (!isset($body['cmd'])) { - throw new Exception('Protocol format error.'); + throw new Exception('Unknown system cmd.'); } $request->params->setPosts($body);