Skip to content

Commit

Permalink
Fixed undefined array key wechat_public_cert_path when don't set it. (
Browse files Browse the repository at this point in the history
#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>
  • Loading branch information
limingxinleo and yansongda committed Sep 7, 2022
1 parent 84682fc commit ebc939e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ function reload_wechat_public_certs(array $params, ?string $serialNo = null): st
}

$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');
Expand Down

0 comments on commit ebc939e

Please sign in to comment.