From:             stevendamico at gmail dot com
Operating system: Windows
PHP version:      5.2.12
PHP Bug Type:     Scripting Engine problem
Bug description:  SimpleXML ::atrributes() feature does not recognize 
hyphenated attributes

Description:
------------
Using SimpleXML and SimpleXML_load_file to load an external XML file. 
The ::attributes feature does not recognize hyphens in attribute 
features, no documentation on how to resolve feature and the solution 
for dealing with hyphens in nodes (by putting it in curly braces and 
quotes {''}) does not solve the problem. 

This is my first time submitting a bug and I'm an amateur, but there 
is no documentation for a solution. Not sure if I selected the proper 
bug category. Sorry for any mistakes.  









Reproduce code:
---------------
---
>From manual page: simplexmlelement.attributes#Description
---

portion of xml file (parent nodes left out for simplicity):

<recorded-vote><legislator name-id="A000014" sort-field="Abercrombie"
unaccented-name="Abercrombie" party="D" state="HI"
role="legislator">Abercrombie</legislator><vote>Aye</vote></recorded-vote>


ex. 1: 

echo {'recorded-vote'}[0]->legislator->attributes()->{'name-id'}; 

ex. 2: 

print_r ({'recorded-vote'}[0]->legislator->attributes());





Expected result:
----------------
ex. 1

A000014

ex. 2

SimpleXMLElement Object ( [...@attributes] => Array ( [name-id] => A000014 
[sort-field] => Abercrombie [unaccented-name] => Abercrombie [party] => 
D [state] => HI [role] => legislator ) ) 


Actual result:
--------------
ex. 1

0 

To clarify, all that outputs is the digit zero. 

ex. 2

SimpleXMLElement Object ( [...@attributes] => Array ( [party] => D [state] 
=> HI [role] => legislator ) ) 


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

Reply via email to