This commit is contained in:
2020-09-15 19:09:12 +08:00
parent 31b336b9a7
commit f27cec805d
2 changed files with 8 additions and 9 deletions
+8 -8
View File
@@ -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;
}
/**