Bug #69491 [Ver->Dup]: simplexml doesn't correctly parse empty nodes on same line as another node

From: Date: Wed, 27 May 2015 17:50:38 +0000
Subject: Bug #69491 [Ver->Dup]: 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-192925@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: Verified +Status: Duplicate Type: Bug Package: SimpleXML related Operating System: Debian PHP Version: 5.6.8 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: After further investigation it turned out that this is a duplicate of bug #66084. Previous Comments: ------------------------------------------------------------------------ [2015-05-26 14:26:36] cmb@php.net Related To: Bug #66084 ------------------------------------------------------------------------ [2015-05-26 12:16:43] cmb@php.net Related To: Bug #62639 ------------------------------------------------------------------------ [2015-04-24 03:13:19] ray dot ward at bigcommerce dot com 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 ------------------------------------------------------------------------ [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

« previous php.bugs (#192925) next »