Zend_Config: Progress Towards 0.2
A week or so ago, I got a chance to sit down (on IM) with Darby and look at the outstanding issues for Zend_Config. We went through the all open issues and the items on the wiki page to ensure we knew what was intended for 0.2. As a result, I filed a few issues with the issue tracker to enhance Zend_Config and note possible bugs.
Essentially, the enhancements are:
- ZF-352. Change the way INI inheritence is defined from using the “extends” special work to using a colon in the section name. (e.g. [thisSection : thatSection])
- ZF-413. Allow loading of multiple sections
- ZF-414. Add getSectionName() and areAllSectionsLoaded() methods
Between them, we’ll be enhancing Zend_Config’s power without making it any harder to use.
This weekend, I got a chance to look at ZF-352 and promptly found two new bugs!
ZF-425 (extends= line must be first in the [section]) is a classic case of unit tests not protecting you from yourself! There are quite a few unit tests for Zend_Config, but none of them ever exercise the case where the “extends” data key is not the first key in a section. This is because I wrote it and it never occurred to me :)
ZF-426 (Setting a key as a scalar and an array fails) is a case where the unit tests don’t cover the all code paths. Thus code in the class that was supposed to handle this case clearly didn’t! Whilst looking at this bug, it crossed my mind that there were two functions in Zend_Config_Ini that did essentially the same thing. So much so, that I couldn’t work out the difference between them! As a result I removed one of the functions whilst fixing ZF-426 and now Zend_Config_Ini is now that much easier to understand :)
Incidentally, there’s a patch attached to ZF-352, if anyone fancies reviewing it…