Fixed undefined array key wechat_public_cert_path when don't set it. (#674)

* Fixed undefined array key `wechat_public_cert_path` when don't set it.

* refactor: 优化 `wechat_public_cert_path` 配置

Co-authored-by: yansongda <me@yansongda.cn>
This commit is contained in:
李铭昕 2022-09-07 16:42:18 +08:00 committed by GitHub
parent 84682fcaee
commit ebc939e1d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,13 @@
## v3.2.1
### fixed
- fix: `wechat_public_cert_path` 未配置时报错的问题(#674)
### refactor
- refactor: 优化 `wechat_public_cert_path` 配置(#674)
## v3.2.0
### changed

View File

@ -221,11 +221,11 @@ if (!function_exists('reload_wechat_public_certs')) {
}
$wechatConfig = get_wechat_config($params);
$wechatConfig['wechat_public_cert_path'] = ((array) $wechatConfig['wechat_public_cert_path']) + ($certs ?? []);
Pay::set(ConfigInterface::class, Pay::get(ConfigInterface::class)->merge([
'wechat' => [$params['_config'] ?? 'default' => $wechatConfig],
]));
Pay::get(ConfigInterface::class)->set(
'wechat.'.get_tenant($params).'.wechat_public_cert_path',
((array) ($wechatConfig['wechat_public_cert_path'] ?? [])) + ($certs ?? []),
);
if (!is_null($serialNo) && empty($certs[$serialNo])) {
throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Get Wechat Public Cert Error');