From 01c8bf2ba9c93306d770a1268c9785089aaf52ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 15 Sep 2020 18:38:41 +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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/HttpServer/Http/Context.php b/HttpServer/Http/Context.php index 52f65d7b..bcddfb67 100644 --- a/HttpServer/Http/Context.php +++ b/HttpServer/Http/Context.php @@ -165,9 +165,15 @@ class Context extends BaseContext public static function hasContext($id, $key = null) { if (static::inCoroutine()) { - $data = Coroutine::getContext()[$id] ?? null; + if (!isset(Coroutine::getContext()[$id])) { + return false; + } + $data = Coroutine::getContext()[$id]; } else { - $data = static::$_requests[$id] ?? null; + if (!isset(static::$_requests[$id])) { + return false; + } + $data = static::$_requests[$id]; } if (empty($data)) { return false;