Bug #61597 [NEW]: SimpleXML drops attributes for tags with both attributes and text

From: Date: Mon, 02 Apr 2012 03:37:26 +0000
Subject: Bug #61597 [NEW]: SimpleXML drops attributes for tags with both attributes and text
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-169122@lists.php.net to get a copy of this message
From:             
Operating system: Mac OS X
PHP version:      5.3.10
Package:          SimpleXML related
Bug Type:         Bug
Bug description:SimpleXML drops attributes for tags with both attributes and text

Description:
------------
When loading XML into SimpleXML, tags which have both attributes and text
will have their attributes dropped.  

For example, loading this into SimpleXML: 
<sometag attribute="value">Here is some text</sometag>

Will cause 'attribute="value"' to be lost.  If there is no text w/in a tag,
but attributes, the attributes and their values are preserved. 

I'm not the only PHP developer to notice this bug; please see: 
http://stackoverflow.com/questions/8563073/disappearing-attributes-in-php-simplexml-object

I didn't see this bug reported on php.net, however. 

Test script:
---------------
See above. 

Expected result:
----------------
Tags with both attributes and text should not have their attributes
dropped. 


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



Thread (13 messages)

« previous php.bugs (#169122) next »