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

当用户信息有 " 字符时系统出错 (用户与用户组管理接口) #107

Closed
enbaby opened this issue Sep 17, 2015 · 9 comments
Closed

Comments

@enbaby
Copy link

enbaby commented Sep 17, 2015

$userService->batchGet($openId); 批量获取用户信息

在调用此接口时,如果用户信息中带有 " 则会json解析错误,具体错误信息如下
ErrorException in User.php line 93:
Illegal string offset 'user_info_list'

问题主要是
https://github.com/overtrue/wechat/blob/2.1/src/Wechat/Http.php#L103

此段没有将文本中的"替换

我是直接改成了
$contents = json_decode(substr(str_replace(array('\\\"','"', '\\'), array('','"', ''), json_encode($response['data'])), 1, -1), true);

虽然成功了,但是却把 " 删除了,希望有更好的解决方案,望指正!

@overtrue
Copy link
Collaborator

微信的接口团队真的是吃屎的

@5-say
Copy link

5-say commented Oct 12, 2015

同感

@overtrue
Copy link
Collaborator

已发微博点名批评 😆

@narutooturan
Copy link

有同样的错误,替换上面的还是会报错 = =

@overtrue
Copy link
Collaborator

overtrue commented Jan 5, 2016

@narutooturan 能不能把返回的json原样取一份发我,用gist

@narutooturan
Copy link

@overtrue 发到您的邮箱了。

@enbaby
Copy link
Author

enbaby commented Jan 7, 2016

持续关注

@narutooturan
Copy link

现在的做法是在User.php line 103前重新验证下是否为数组,如果不是重新用一下json_decode。这样是没有报错了,但是跑了一会儿之后经常会返回错误,不知道为什么 = =
错误:
[Wechat]获取access_token时AppSecret错误,或者access_token无效。请开发者认真比对AppSecret的正确性,或查看是否正在为恰当的公众号调用接口

@xiaohome
Copy link

@overtrue 我记得这个错误 我提交过呀!!! 你也都合并了

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

5 participants