#41172 [NEW]: SimpleXML empty attributes

From: Date: Mon, 23 Apr 2007 15:41:14 +0000
Subject: #41172 [NEW]: SimpleXML empty attributes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111825@lists.php.net to get a copy of this message
From: fedelman at gmail dot com Operating system: Gentoo Linux PHP version: 5.2.1 PHP Bug Type: DOM XML related Bug description: SimpleXML empty attributes Description: ------------ When I've got a node with one attribute and text, the SimpleXML does not return the attribute, it only return the text. Please, see the example. I think may be it's this is a bug. Reproduce code: --------------- $strXml = " <root> <data myattr=\"This is the value\">This is the text</data> </root>"; $oXML=simplexml_load_string($strXml); echo "<pre>"; var_dump($oXML); echo "</pre>"; Expected result: ---------------- object(SimpleXMLElement)#1 (2) { ["@attributes"]=> array(1) { ["myattr1"]=> string(17) "This is the value" } string(16) "This is the text" } Actual result: -------------- object(SimpleXMLElement)#1 (1) { ["data"]=> string(16) "This is the text" } -- Edit bug report at http://bugs.php.net/?id=41172&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41172&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41172&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41172&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41172&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41172&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41172&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41172&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41172&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41172&r=support Expected behavior: http://bugs.php.net/fix.php?id=41172&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41172&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41172&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41172&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41172&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41172&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41172&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41172&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41172&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41172&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41172&r=mysqlcfg

« previous php.bugs (#111825) next »