ZF-11004: Zend_Config doesn't recognize top-level arrays
Description
When Zend_Config is being instanciated with a top-level array, this isn't being recognized:
<?xml version="1.0" encoding="UTF-8" ?>
with toArray method and var_dump wrapper:
array(1) {
["tables"]=>
array(1) {
["name"]=>
string(9) "employees"
}
}
Now, if you put this array inside another tag, array is recognized:
<?xml version="1.0" encoding="UTF-8" ?>
this is PHP output:
array(1) {
["dummytag"]=>
array(1) {
["tables"]=>
array(2) {
[0]=>
array(1) {
["name"]=>
string(9) "employees"
}
[1]=>
array(1) {
["name"]=>
string(9) "vacations"
}
}
}
}
I believe this has to do with the fact that Zend_Config starts iterating over the array without checking numeric indexes. It only checks whether the value is an array. This make child nodes to be recognized as arrays.
Comments
Posted by Kai Uwe (kaiuwe) on 2011-01-28T05:47:45.000+0000
The example above is a bit confusing!