From 2a0af6beac6e1fdcf7753eb83b28667ded2990ee Mon Sep 17 00:00:00 2001 From: lin <465382251@qq.com> Date: Sat, 9 Oct 2021 10:17:34 +0800 Subject: [PATCH] compatible with PHP version 8 --- src/Request.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Request.php b/src/Request.php index 0f8367d..4ac3a01 100644 --- a/src/Request.php +++ b/src/Request.php @@ -148,6 +148,8 @@ protected function exec(){ try { return json_decode($this->send(),true); }catch (RequestException $e){ + if(empty($e->getResponse()) || $e->getResponse()==null) throw new Exception(json_encode(['_message'=>'system error'])); + if(method_exists($e->getResponse(),'getBody')){ $contents=$e->getResponse()->getBody()->getContents();