Bug #69491 [Com]: simplexml doesn't correctly parse empty nodes on same line as another node
| From: | ray dot ward at bigcommerce dot com | Date: | Fri, 24 Apr 2015 03:13:19 +0000 |
| Subject: | Bug #69491 [Com]: simplexml doesn't correctly parse empty nodes on same line as another node | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192312@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69491&edit=1
ID: 69491
Comment by: ray dot ward at bigcommerce dot com
Reported by: ray dot ward at bigcommerce dot com
Summary: simplexml doesn't correctly parse empty nodes on
same line as another node
Status: Verified
Type: Bug
Package: SimpleXML related
Operating System: Debian
PHP Version: 5.6.8
Block user comment: N
Private report: N
New Comment:
The issue looks like it can be generalised to just problems with whitespace parsing, rather than
lines.
broken: http://3v4l.org/66O5Y
working: http://3v4l.org/C0JVE
Previous Comments:
------------------------------------------------------------------------
[2015-04-24 01:15:29] cmb@php.net
Compare <http://3v4l.org/7aTML> vs. <http://3v4l.org/vFdbY>.
------------------------------------------------------------------------
[2015-04-21 02:33:28] ray dot ward at bigcommerce dot com
Description:
------------
This is very similar to https://bugs.php.net/bug.php?id=66084
When an empty node is within another node on the same line of a multi-line xml file, the empty node
name gets parsed as an integer.
If the empty node gets moved to its own line, then it gets parsed correctly.
This previously worked in PHP 5.3, now fails in 5.4, 5.5 and 5.6.
Test script:
---------------
FAILS:
var_dump(simplexml_load_string('<a>
<b><c/></b>
</a>'));
WORKS:
var_dump(simplexml_load_string('<a>
<b>
<c/>
</b>
</a>'));
Expected result:
----------------
object(SimpleXMLElement)#1 (1) {
["b"]=>
object(SimpleXMLElement)#3 (1) {
["c"]=>
object(SimpleXMLElement)#2 (0) {
}
}
}
Actual result:
--------------
object(SimpleXMLElement)#1 (1) {
["b"]=>
object(SimpleXMLElement)#3 (1) {
[0]=>
object(SimpleXMLElement)#2 (0) {
}
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69491&edit=1