From 071e3d5667b0546c80bdb7b025822553ffaee3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 19 Jan 2021 18:50:42 +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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/HttpServer/Http/Context.php b/HttpServer/Http/Context.php index 905abb44..2dbcd81f 100644 --- a/HttpServer/Http/Context.php +++ b/HttpServer/Http/Context.php @@ -173,7 +173,13 @@ class Context extends BaseContext public static function hasContext($id, $key = null): bool { if (!static::inCoroutine()) { - return false; + if (!isset(static::$_requests[$id]) || empty(static::$_requests[$id])) { + return false; + } + if (!empty($key) && !isset(static::$_requests[$id][$key])) { + return false; + } + return true; } if (!isset(Coroutine::getContext()[$id])) { return false;