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

response_type设为object一列系调用会报错 #1995

Closed
haohetao opened this issue Dec 22, 2020 · 7 comments
Closed

response_type设为object一列系调用会报错 #1995

haohetao opened this issue Dec 22, 2020 · 7 comments

Comments

@haohetao
Copy link

haohetao commented Dec 22, 2020

我用的环境

  • PHP 版本:7.4.13
  • overtrue/wechat 版本:4.3.4
  • 是否使用了框架?框架名称:yii2

问题及现象

config配置response_type为object,就会出现一列系接口报错,目前发现的有如下
$openPlatform->getPreAuthorizationUrl()
$openPlatform->server->serve()
错误日志如下:

2020-12-22 21:37:59 [172.23.0.10][-][-][error][Error] Error: Cannot use object of type stdClass as array in /var/www/yunshop-yunshop/vendor/overtrue/wechat/src/OpenPlatform/Server/Handlers/VerifyTicketRefreshed.php:42
Stack trace:
#0 /var/www/yunshop-yunshop/vendor/overtrue/wechat/src/Kernel/Traits/Observable.php(250): EasyWeChat\OpenPlatform\Server\Handlers\VerifyTicketRefreshed->handle(Object(stdClass))
#1 [internal function]: EasyWeChat\Kernel\ServerGuard->EasyWeChat\Kernel\Traits{closure}(Object(stdClass))
#2 /var/www/yunshop-yunshop/vendor/overtrue/wechat/src/Kernel/Traits/Observable.php(213): call_user_func_array(Object(Closure), Array)
#3 /var/www/yunshop-yunshop/vendor/overtrue/wechat/src/Kernel/Traits/Observable.php(150): EasyWeChat\Kernel\ServerGuard->callHandler(Object(Closure), Object(stdClass))
#4 /var/www/yunshop-yunshop/vendor/overtrue/wechat/src/Kernel/Traits/Observable.php(128): EasyWeChat\Kernel\ServerGuard->notify('component_verif...', Object(stdClass))
#5 /var/www/yunshop-yunshop/vendor/overtrue/wechat/src/OpenPlatform/Server/Guard.php(47): EasyWeChat\Kernel\ServerGuard->dispatch('component_verif...', Object(stdClass))
#6 /var/www/yunshop-yunshop/vendor/overtrue/wechat/src/Kernel/ServerGuard.php(105): EasyWeChat\OpenPlatform\Server\Guard->resolve()
#7 /var/www/yunshop-yunshop/merchant/controllers/WechatPlatformController.php(9): EasyWeChat\Kernel\ServerGuard->serve()
#8 [internal function]: merchant\controllers\WechatPlatformController->actionCreate()

2020-12-22 21:49:08 [172.23.0.10][-][-][error][Error] Error: Cannot use object of type stdClass as array in /var/www/yunshop-yunshop/vendor/overtrue/wechat/src/OpenPlatform/Application.php:112
Stack trace:
#0 /var/www/yunshop-yunshop/merchant/controllers/WechatPlatformController.php(2): EasyWeChat\OpenPlatform\Application->getPreAuthorizationUrl('https://wx.shua...')
#1 [internal function]: merchant\controllers\WechatPlatformController->actionAuth('ZwAk+QkwrUsnbRe...', '2')
#2 /var/www/yunshop-yunshop/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#3 /var/www/yunshop-yunshop/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#4 /var/www/yunshop-yunshop/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('auth', Array)
#5 /var/www/yunshop-yunshop/vendor/yiisoft/yii2/web/Application.php(104): yii\base\Module->runAction('wechat-platform...', Array)
#6 /var/www/yunshop-yunshop/vendor/yiisoft/yii2/base/Application.php(392): yii\web\Application->handleRequest(Object(yii\web\Request))
#7 /var/www/yunshop-yunshop/merchant/web/index.php(17): yii\base\Application->run()

建议

easywechat内部应根据response_type设置的类型解析并读取数据或始终用array方式解析数据

@haohetao haohetao changed the title response_type设为object一列系接口会报错 response_type设为object一列系调用会报错 Dec 22, 2020
@haohetao
Copy link
Author

@overtrue
看一下能不能改

overtrue added a commit that referenced this issue Dec 23, 2020
overtrue added a commit that referenced this issue Dec 23, 2020
@haohetao
Copy link
Author

@overtrue thanks

@overtrue
Copy link
Collaborator

客气

@haohetao
Copy link
Author

@overtrue
我这composer拉取不到呀,用4.x-dev也不行
https://packagist.org/packages/overtrue/wechat#4.x-dev

@overtrue
Copy link
Collaborator

请再试

@haohetao
Copy link
Author

@overtrue
可以了

@overtrue
Copy link
Collaborator

好的

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

No branches or pull requests

2 participants