Skip to content
New issue

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

支付宝回调参数中subject中存在'+'符号会验签失败 #681

Closed
huang-yoshio opened this issue Sep 17, 2022 · 4 comments · Fixed by #684
Closed

支付宝回调参数中subject中存在'+'符号会验签失败 #681

huang-yoshio opened this issue Sep 17, 2022 · 4 comments · Fixed by #684

Comments

@huang-yoshio
Copy link

包版本号

v3.1.12

问题描述

已知以下代码中的urldecode会把subject中存在的+转为空格,从而导致验签失败

# Plugin/Alipay/CallbackPlugin.php
protected function getSignContent(Collection $payload): string
{
    return urldecode($payload->sortKeys()->toString());
}
@yansongda
Copy link
Owner

文档里的 'subject' => 'yansongda 测试 - 1' 实测没问题

截屏2022-09-17 21 00 26

@huang-yoshio
Copy link
Author

你好,你好像误解我的意思了,我这边是'subject' => '会员+'中存在+验签失败

测试了更改getSignContent方法不进行urldecode则能验签通过

# Plugin/Alipay/CallbackPlugin.php
protected function getSignContent(Collection $payload): string
{
    return $payload->sortKeys()->toString();
    // return urldecode($payload->sortKeys()->toString());
}

@yansongda
Copy link
Owner

这个 urldecode 我印象中好像也是由于某个 issue 加进来的,但具体哪个我找不到了

@yansongda
Copy link
Owner

应该和老接口的 passback_params 这个参数有关,这个参数新版接口已经没有了

我先暂时去掉 urldecode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants