Home » Configuration » Config » Bug #3298
Processing XML to array and then back to XML
Details
| Submitted | 2005-01-26 09:36 UTC |
|---|---|
| From | daniel at assertio dot es |
| Assigned | ryansking |
| Status | Closed |
| Package | Config |
| PHP Version | 5.0.2 |
| OS | Win XP |
| Roadmaps | (Not assigned) |
Comments
[2005-01-26 09:36 UTC] daniel at assertio dot es
Description:
------------
Hi,
The idea was to write a function / method to turn a configuration into a QuickForm to ease the editing. I thought of reading the XML file into an array, create an analogous form, and then write back the configuration using the submitted form values.
I found the problem that, if there are elements with the same name, they are not rendered back in the same way. Please run the supplied code to reproduce.
Reproduce code:
---------------
http://www.quintopino.com/pear/pear_config_bug.phps
Patch:
File PEAR/Config/Container/PHPArray.php, lines 108 to 114 changed to:
default:
if (is_array($value)) {
if (is_integer(key($value))) {
foreach ($value as $nestedValue) {
$section =& $container->createSection($key);
$this->_parseArray($nestedValue, $section);
}
} else {
$section =& $container->createSection($key);
$this->_parseArray($value, $section);
}
} else {
$container->createDirective($key, $value);
}
[2005-02-10 06:03 UTC] ryansking at mac dot com
Ok. I applied the patch you supplied. Please test the
cvs version.
[2005-02-12 19:19 UTC] ryansking at mac dot com
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pear.php.net/get/Config
This should be fixed in 1.10.4.