We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
直接抛异常 EasyWeChat\Kernel\Support\Arr::exists(): Argument #1 ($array) must be of type array, null given
EasyWeChat\Kernel\Support\Arr::exists(): Argument #1 ($array) must be of type array, null given
在Arr的get方法中增加给$array赋值的判断,如果$array[$segment]值为空或不是数组,直接返回 $default,问题解决
public static function get(array $array, string|int|null $key, mixed $default = null): mixed { if (is_null($key)) { return $array; } if (static::exists($array, $key)) { return $array[$key]; } foreach (explode('.', (string) $key) as $segment) { /** @phpstan-ignore-next-line */ if (static::exists($array, $segment)) { /** @phpstan-ignore-next-line */ if (empty($array[$segment]) || !is_array($array[$segment])) { return $default; } $array = $array[$segment]; } else { return $default; } } return $array; }
The text was updated successfully, but these errors were encountered:
eef0723
Fixed #2647
784a82e
No branches or pull requests
我用的环境
问题及现象
直接抛异常
EasyWeChat\Kernel\Support\Arr::exists(): Argument #1 ($array) must be of type array, null given
在Arr的get方法中增加给$array赋值的判断,如果$array[$segment]值为空或不是数组,直接返回 $default,问题解决
The text was updated successfully, but these errors were encountered: