[PHP-BUG] Bug #51517 [NEW]: Node attributes lost when it has both attributes and value

[email protected] ("zhangxc83 at sohu dot com") Fri, 9 Apr 2010 04:31:04 +0200 (CEST)
Newsgroups php.bugs
Message-ID <[email protected]>
From:             
Operating system: Linux 2.6.18-92.el5
PHP version:      5.3.2
Package:          SimpleXML related
Bug Type:         Bug
Bug description:Node attributes lost when it has both attributes and value

Description:
------------
AS Test Scripts below:

Test script:
---------------
$xml = <<<EOT
<?xml version="1.0" encoding="UTF-8"?>
<root>
<report id="testid">test value</report>
</root>
EOT;

$xml = new \SimpleXMLElement(trim($xml));
print_r($xml);


Expected result:
----------------
.SimpleXMLElement Object
(
    [report] => .SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [id] => testid
        )

    [0] => test value
)
)



Actual result:
--------------
.SimpleXMLElement Object
(
    [report] => test value
)


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