Skip to content

Commit 8a23c56

Browse files
Fixed Invalid argument supplied for Hyperf\Testing\Client::flushContext. (#1477)
* - 解决 Hyperf\Testing\Client::flushContext 因获取上下文返回 nul 时报 Invalid ar gument supplied for foreach() 的问题 Co-authored-by: 李铭昕 <[email protected]>
1 parent 348ef97 commit 8a23c56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ protected function init(string $method, string $path, array $options = []): arra
194194

195195
protected function flushContext()
196196
{
197-
$context = SwCoroutine::getContext();
197+
$context = SwCoroutine::getContext() ?? [];
198198

199199
foreach ($context as $key => $value) {
200200
if (Str::startsWith($key, $this->ignoreContextPrefix)) {

0 commit comments

Comments
 (0)