Bug #52463 [Com]: SimpleXml ignores attributes
| From: | php at kenman dot net | Date: | Thu, 03 Apr 2014 17:30:35 +0000 |
| Subject: | Bug #52463 [Com]: SimpleXml ignores attributes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-185075@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52463&edit=1
ID: 52463
Comment by: php at kenman dot net
Reported by: circus2 at freenet dot de
Summary: SimpleXml ignores attributes
Status: Duplicate
Type: Bug
Package: SimpleXML related
Operating System: Win7 Home Premium GER
PHP Version: 5.3.3
Block user comment: N
Private report: N
New Comment:
As circus2 at freenet dot de points out, this is not merely a var_dump() issue.
Here's a repro from the linked issue (Bug #66084); note the only difference in input is a
single space in the XML:
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>'));
Previous Comments:
------------------------------------------------------------------------
[2014-04-02 15:55:47] ab@php.net
Related To: Bug #66084
------------------------------------------------------------------------
[2014-04-02 12:15:43] zashme at gmail dot com
I have the same problem, i have PHP 5.5.10 x86_64, linux 3.13.6
------------------------------------------------------------------------
[2013-06-19 07:27:46] nm at lindenvalley dot de
have same problem, it's not var_dump error, because print_r has same trouble
code:
$xmlObj = simplexml_load_string($xml_string);
print_r ($xmlObj);
------------------------------------------------------------------------
[2010-07-28 07:14:28] circus2 at freenet dot de
I'm not concerned about var_dump(). I think more of json_encode() which has the same issues. I
use json_encode/json_decode to transform a SimpleXml object to an array.
print_r(json_decode(json_encode($xml), true)));
------------------------------------------------------------------------
[2010-07-27 23:10:27] rasmus@php.net
This is a known cosmetic issue in var_dump(). If you actually iterate through the
object it works fine.
------------------------------------------------------------------------
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=52463
--
Edit this bug report at https://bugs.php.net/bug.php?id=52463&edit=1