yansongda / pay

可能是我用过的最优雅的 Alipay/WeChat/Douyin/Unipay/江苏银行 的支付 SDK 扩展包了
http://pay.yansongda.cn
MIT License
5.05k stars 1.03k forks source link

thinkphp6 使用v3.3.0 时,thinkphp加载环境变量函数 env()与hyperf/utils中 env() 冲突,变成使用hyperf/utils中 env() ,请求参数缺失 #797

Closed ovolh closed 1 year ago

ovolh commented 1 year ago

包版本号

v3.3.0

问题描述

thinkphp6 使用v3.2.14功能正常,升级v3.3.0 时,thinkphp加载环境变量函数 env()与hyperf/utils中 env() 冲突,会使用hyperf/utils中 env() ,导致请求参数缺失,请求的所有接口都异常, v3.2.14是正常的

你的代码

配置文件中

'mch_id' => env('wx.mch_id', ''),

报错详情

{
                    "exception": null,
                    "response": {
                        "headers": {
                            "Server": [
                                "nginx"
                            ],
                            "Date": [
                                "Tue, 30 May 2023 07:32:47 GMT"
                            ],
                            "Content-Type": [
                                "application/json; charset=utf-8"
                            ],
                            "Content-Length": [
                                "252"
                            ],
                            "Connection": [
                                "keep-alive"
                            ],
                            "Keep-Alive": [
                                "timeout=8"
                            ],
                            "Cache-Control": [
                                "no-cache, must-revalidate"
                            ],
                            "X-Content-Type-Options": [
                                "nosniff"
                            ],
                            "Request-ID": [
                                "089FCDD6A306106018B5DFEEA30620800D28A019-270924332",
                                "089FCDD6A306106018B5DFEEA30620800D28A019-0"
                            ],
                            "Content-Language": [
                                "zh-CN"
                            ]
                        },
                        "body": "{\"code\":\"SIGN_ERROR\",\"detail\":{\"detail\":{\"issue\":\"sign not match\"},\"field\":\"signature\",\"location\":\"authorization\",\"sign_information\":{\"method\":\"\",\"sign_message_length\":141733169,\"truncated_sign_message\":\"\",\"url\":\"\"}},\"message\":\"Authorization不合法\"}"
                    },
                    "extra": {
                        "headers": {
                            "Server": [
                                "nginx"
                            ],
                            "Date": [
                                "Tue, 30 May 2023 07:32:47 GMT"
                            ],
                            "Content-Type": [
                                "application/json; charset=utf-8"
                            ],
                            "Content-Length": [
                                "252"
                            ],
                            "Connection": [
                                "keep-alive"
                            ],
                            "Keep-Alive": [
                                "timeout=8"
                            ],
                            "Cache-Control": [
                                "no-cache, must-revalidate"
                            ],
                            "X-Content-Type-Options": [
                                "nosniff"
                            ],
                            "Request-ID": [
                                "089FCDD6A306106018B5DFEEA30620800D28A019-270924332",
                                "089FCDD6A306106018B5DFEEA30620800D28A019-0"
                            ],
                            "Content-Language": [
                                "zh-CN"
                            ]
                        },
                        "body": "{\"code\":\"SIGN_ERROR\",\"detail\":{\"detail\":{\"issue\":\"sign not match\"},\"field\":\"signature\",\"location\":\"authorization\",\"sign_information\":{\"method\":\"\",\"sign_message_length\":141735169,\"truncated_sign_message\":\"\",\"url\":\"\"}},\"message\":\"Authorization不合法\"}"
                    }
                }

sdk 日志

[5003][/www/项目/vendor/yansongda/pay/src/Functions.php:203]
yansongda commented 1 year ago

得等到后面 php8 的版本了

yansongda commented 1 year ago

更新到 v3.4.0 版本,同时 hyperf/pimple 升级至 v2.2.0 及以上版本即可