#46048 [NEW]: SimpleXML top-level @attributes not part of iterator

From: Date: Wed, 10 Sep 2008 23:58:50 +0000
Subject: #46048 [NEW]: SimpleXML top-level @attributes not part of iterator
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-128862@lists.php.net to get a copy of this message
From:             php at isnoop dot net
Operating system: Ubuntu 8.04 server
PHP version:      5.3.0alpha2
PHP Bug Type:     SimpleXML related
Bug description:  SimpleXML top-level @attributes not part of iterator

Description:
------------
The @attributes for the top-level element in a SimpleXMLElement object
aren't returned as part of any iteration over the object.

Reproduced in 5.3.0alpha1 as well.

Reproduce code:
---------------
$xml = '
<data id="1">
	<key>value</name>
</data>
';
$obj = simplexml_load_string($xml);
print_r(get_object_vars($obj));


Expected result:
----------------
Array
(   
    [@attributes] => Array
        (   
            [id] => 1
        )
    [key] => value
)



Actual result:
--------------
Array
(   
    [key] => value
)



-- 
Edit bug report at http://bugs.php.net/?id=46048&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46048&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46048&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46048&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=46048&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=46048&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=46048&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=46048&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=46048&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=46048&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=46048&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=46048&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=46048&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=46048&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=46048&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=46048&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=46048&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=46048&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=46048&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=46048&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=46048&r=mysqlcfg



Thread (11 messages)

« previous php.bugs (#128862) next »