#48078 [Opn->Bgs]: SimpleXML allows white spaces as attribute names
| From: | iliaa@php.net | Date: | Sun, 26 Apr 2009 14:51:53 +0000 |
| Subject: | #48078 [Opn->Bgs]: SimpleXML allows white spaces as attribute names | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-136325@lists.php.net to get a copy of this message | ||
ID: 48078
Updated by: iliaa@php.net
Reported By: ifeghali@php.net
-Status: Open
+Status: Bogus
Bug Type: SimpleXML related
Operating System: Mac OS X
PHP Version: 5.3.0RC1
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
I think its more along the lines of a libxml2 bug then PHP's since
attribute creation is done by simply calling the libxml API. PHP cannot
perform validation on XML.
Previous Comments:
------------------------------------------------------------------------
[2009-04-26 12:18:27] ifeghali@php.net
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 this bug report at http://bugs.php.net/?id=48078&edit=1