Home » Configuration » Config » Bug #5367
XML Rootnode Attributes aren't exported
Details
| Submitted | 2005-09-12 12:18 UTC |
|---|---|
| From | stephan at wentz dot it |
| Assigned | mansion |
| Status | Closed |
| Package | Config |
| PHP Version | 5.0.4 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-09-12 12:18 UTC] stephan at wentz dot it
Description:
------------
Exporting this array
Array
(
[@] => Array
(
[revision] => 15
)
[content_str] => [headline]
[align] => right
[size] => medium
[color] => FF3333
)
to XML with Config 1.10.4 doesn't add the revision-attribute to the rootnode.
This can be achieved easily, replace line 198
$string .= '<'.$this->options['name'].'>'.$this->options['linebreak'];
with
$string .= '<'.$this->options['name'];
$string .= ($this->options['useAttr']) ? XML_Util::attributesToString($obj->attributes) : '';
$string .= '>'.$this->options['linebreak'];
and it will add the attributes to the rootnode.
Test script:
---------------
$data = array(
'@' => array(
'revision' => 15
),
'content_str' => '[headline]'
);
$conf = new Config;
$root =& $conf->parseConfig($data, 'PHPArray', array('name'=>'data'));
print_r($root->toString('XML', array('name'=>'data', 'useCData'=>true)));
Expected result:
----------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<data revision="15">
<content_str>
<![CDATA[ [headline] ]]>
</content_str>
</data>
Actual result:
--------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<data>
<content_str>
<![CDATA[ [headline] ]]>
</content_str>
</data>
[2005-11-08 17:42 UTC] mansion at php dot net
This bug has been fixed in CVS.
If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).
If this was a problem with the pear.php.net website, the change should be live shortly.
Otherwise, the fix will appear in the package's next release.
Thank you for the report and for helping us make PEAR better.