Bug #66084 [Ver->Csd]: simplexml_load_string() mangles empty node name

From: Date: Sat, 05 Apr 2014 07:51:03 +0000
Subject: Bug #66084 [Ver->Csd]: simplexml_load_string() mangles empty node name
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185104@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66084&edit=1 ID: 66084 Updated by: ab@php.net Reported by: php at kenman dot net Summary: simplexml_load_string() mangles empty node name -Status: Verified +Status: Closed Type: Bug Package: SimpleXML related Operating System: Win7 PHP Version: 5.5Git-2013-11-12 (snap) Assigned To: ab Block user comment: N Private report: N New Comment: Automatic comment on behalf of ab Revision: http://git.php.net/?p=php-src.git;a=commit;h=a0beddf5e9ab3c6feaf0921be72a7f430597abea Log: Fixed bug #66084 simplexml_load_string() mangles empty node name Previous Comments: ------------------------------------------------------------------------ [2014-04-04 15:19:00] ab@php.net @php at kenman dot net thanks for figuring the json thing out. What I meant previously - it actually doesn't matter which function is used because often it will lead back to the get_properties callback of the corresponding object. So this is not a var_dump issue at all :) If it's only to see with var_dump, it's not of that prio as if that affects something like json. Thanks ------------------------------------------------------------------------ [2014-04-03 17:30:35] php at kenman dot net Related To: Bug #52463 ------------------------------------------------------------------------ [2014-04-03 17:28:09] php at kenman dot net I respectfully disagree, this is not merely a var_dump() issue. It may be true that there are var_dump() anomalies here, but that's not the root of the issue. The bug was exposed for me by missing data in the final output (JSON). I traced the data stream back and discovered what's reported in this ticket. Here's a reproduction that doesn't use var_dump(): echo json_encode(simplexml_load_string('<a><b/><c><x/></c></a>')), PHP_EOL; echo json_encode(simplexml_load_string('<a><b/><c> <x/></c></a>')); ------------------------------------------------------------------------ [2014-04-02 15:55:47] ab@php.net Ref bug #52463, same var_dump() issue. ------------------------------------------------------------------------ [2013-11-14 21:57:55] php at kenman dot net Just a note for anyone else that might come across this problem... A little background: I create the XML originally as a DOMDocument, and then I call saveXML() to generate the XML string. Then, I load that XML with simplexml_load_string() and eventually convert it to JSON (don't ask about the convoluted process, not my choice). I was able to work-around the issue by setting DOMDocument->formatOutput = true -- as per my last note, the whitespace seems to hide the issue, and so now when I pass it to simplexml_load_string() I get the expected output. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=66084 -- Edit this bug report at https://bugs.php.net/bug.php?id=66084&edit=1

« previous php.bugs (#185104) next »