Bug #61597 [Opn]: SimpleXMLElement doesn't include both @attributes and textContent in properties

From: Date: Wed, 09 Sep 2015 01:32:46 +0000
Subject: Bug #61597 [Opn]: SimpleXMLElement doesn't include both @attributes and textContent in properties
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195893@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61597&edit=1 ID: 61597 Updated by: cmb@php.net Reported by: drgroove at gmail dot com Summary: SimpleXMLElement doesn't include both @attributes and textContent in properties Status: Open Type: Bug Package: SimpleXML related Operating System: Mac OS X PHP Version: 5.3.10 Block user comment: N Private report: N New Comment: > This has been reported and closed as a duplicate before, but I > think that was mistaken, as we don't have an open bug for this > at present that I can find. There is bug #44973, which has been closed as not a bug. Previous Comments: ------------------------------------------------------------------------ [2015-04-28 17:06:50] tlesher at mtadistributors dot com Just by way of a note, this problem is still occurring in PHP 5.5.24. ------------------------------------------------------------------------ [2012-11-26 22:37:04] dbai at drivenbi dot com Is there any update on this one? A 3rd party PHP library I'm using has a defect which, I think, is caused by this problem because the phenomenon is that attribute in the XML node is not loaded, and that XML node happens to have text content. ------------------------------------------------------------------------ [2012-07-04 16:31:48] hugh at infomenta dot com I am having exactly the same problem and it is not feasible to add an extra tag to all of my "text" entries. ------------------------------------------------------------------------ [2012-04-13 01:59:42] aharvey@php.net Ah, I see what you're getting at now. Thanks. It appears to be an issue with the get_properties and get_debug_info handlers for SimpleXMLElement. This has been reported and closed as a duplicate before, but I think that was mistaken, as we don't have an open bug for this at present that I can find. ------------------------------------------------------------------------ [2012-04-12 19:51:23] jplyon dot csu at gmail dot com another test: $xml = <<<'EOX' <?xml version="1.0"?> <data> <datum file-key="8708124062829849862">corn</datum> </data> EOX; $doc = simplexml_load_string($xml); echo $doc->asXML(); echo print_r($doc); This is not a problem with loading for me - I am building my SimpleXML object dynamically. The output from asXML() is correct. The output from print_r() is not. The output using attributes() (in a more complex example) is not correct, although this simple test does work. I am experiencing this on various versions of PHP 5.3.X on Windows Vista and Ubuntu 11.10. (ubuntu)$ php -v PHP 5.3.2-1ubuntu4.9 with Suhosin-Patch (cli) (built: May 3 2011 00:45:52) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH (Windows)>php -v PHP 5.3.8 (cli) (built: Sep 22 2011 20:51:51) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies ------------------------------------------------------------------------ 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=61597 -- Edit this bug report at https://bugs.php.net/bug.php?id=61597&edit=1

« previous php.bugs (#195893) next »