From:             ifegh...@php.net
Operating system: Mac OS X
PHP version:      5.3.0RC1
PHP Bug Type:     SimpleXML related
Bug description:  SimpleXML allows white spaces as attribute names

Description:
------------
SimpleXML allows the creation of attributes containing white spaces in the
name. This violates the XML specs [1].

* reported by Thiago Toledo during PHP Test Fest 2009 (Rio UG).

[1] http://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NameChar

Reproduce code:
---------------
<?php
    $xmlExample = "<?xml version='1.0'
standalone='yes'?><allNodes></allNodes>";
    $myXML = new SimpleXMLElement($xmlExample);
    $myXML->addAttribute('Basic Attribute','Basic Attribute Content');
    echo $myXML->asXML();
?>

Expected result:
----------------
Warning: Wrong character for XML attribute name

Actual result:
--------------
<?xml version="1.0" standalone="yes"?>
<allNodes Basic Attribute="Basic Attribute Content"/>

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

Reply via email to