Bug #69491 [Opn->Ver]: simplexml doesn't correctly parse empty nodes on same line as another node
| From: | cmb@php.net | Date: | Fri, 24 Apr 2015 01:15:30 +0000 |
| Subject: | Bug #69491 [Opn->Ver]: 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-192311@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
Updated by: cmb@php.net
Reported by: ray dot ward at bigcommerce dot com
Summary: simplexml doesn't correctly parse empty nodes on
same line as another node
-Status: Open
+Status: Verified
Type: Bug
Package: SimpleXML related
Operating System: Debian
PHP Version: 5.6.8
Block user comment: N
Private report: N
New Comment:
Compare <http://3v4l.org/7aTML> vs. <http://3v4l.org/vFdbY>.
Previous Comments:
------------------------------------------------------------------------
[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