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

[3.0] EasyWeChat\Support\XML::parse方法会将空节点解析为空数组,而不是空字符串 #426

Closed
Baiqiang opened this issue May 24, 2016 · 0 comments

Comments

@Baiqiang
Copy link

Baiqiang commented May 24, 2016

我用的环境

PHP 版本:7.0.3
overtrue/wechat 版本:3.0

问题及现象

微信推送的消息里经常会有空标签,如通常的关注/取关事件里,EventKey都是空的,xml内容都是<EventKey><![CDATA[]]></EventKey>,在simplexml_load_string时,这个节点会被解析成SimpleXMLElement对象,而不是字符串,因此会在随后的arrarval方法中被转成空数组。
因此我在使用中就不得不判断每个字段是否为空数组,是的话转为空字符串,否则写入数据库时参数绑定就会出错。
不知道作者是否注意到这个问题?

overtrue added a commit that referenced this issue May 24, 2016
overtrue added a commit that referenced this issue May 25, 2016
* XML empty node bugfix #426.

* Applied fixes from StyleCI (#427)

* Auto validate.

* Fix server test.

* Applied fixes from StyleCI (#428)
overtrue added a commit that referenced this issue Jun 2, 2016
* XML empty node bugfix #426.

* Applied fixes from StyleCI (#427)

* Auto validate.

* Fix server test.

* Applied fixes from StyleCI (#428)

* Fix tests #430

* Add comment.

* Applied fixes from StyleCI (#434)

* Add getMessage() to server guard.
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