From f27cec805d7c98d445077cb21ad42f2073296875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 15 Sep 2020 19:09:12 +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 --- HttpServer/Http/Context.php | 16 ++++++++-------- HttpServer/Http/Request.php | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/HttpServer/Http/Context.php b/HttpServer/Http/Context.php index 555c94a7..19ae572f 100644 --- a/HttpServer/Http/Context.php +++ b/HttpServer/Http/Context.php @@ -64,16 +64,16 @@ class Context extends BaseContext if (!static::hasContext($id)) { Coroutine::getContext()[$id] = []; } - if (empty($key)) { - return Coroutine::getContext()[$id] = $context; - } - $oldData = Coroutine::getContext()[$id]; - if (!is_array($oldData)) { - $oldData = [$key => $context]; + if (!empty($key)) { + if (!is_array(Coroutine::getContext()[$id])) { + Coroutine::getContext()[$id] = [$key => $context]; + } else { + Coroutine::getContext()[$id][$key] = $context; + } } else { - $oldData[$key] = $context; + Coroutine::getContext()[$id] = $context; } - return Coroutine::getContext()[$id] = $oldData; + return $context; } /** diff --git a/HttpServer/Http/Request.php b/HttpServer/Http/Request.php index 4dbd43ea..d0c7cc32 100644 --- a/HttpServer/Http/Request.php +++ b/HttpServer/Http/Request.php @@ -403,7 +403,6 @@ class Request extends Application } /** - * @param $router * @return bool */ public function isNotFound()