SimpleXML element comparison is broken
未关闭
还没有人认领这个 Issue。
Bug
Extension: simplexml
Status: Verified
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
The following code:
<?php
$xml = "<root><first/><second/><third/></root>";
$xml = simplexml_load_string($xml);
var_dump($xml->first == $xml->second);
Resulted in this output:
bool(true)
But I expected this output instead:
bool(false)
It's because the wrong node is fetched, i.e. it doesn't take into account the iterating nature of the simple xml objects. PoC fix patch (needs more testing and thinking): https://gist.github.com/nielsdos/f8e232836d72e68c5d3418116ddad877
PHP Version
PHP 5.0.0-master
Operating System
Linux
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行 issue 中的 SimpleXML 复现程序,并跟踪 $xml->first 与 $xml->second 的比较如何选择节点。以链接的 PoC 补丁为上下文,然后验证同一个示例报告 bool(false),并检查相关的 SimpleXML 比较行为是否存在回归。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100