ZF-9661: Zend_Config_Ini Problem with 0 (zero) as property name

Description

I have a config.ini file in which i use 0 as a property/key name. Until now i was using zend framework 1.5.2, but i'm now updating.

The problem appeared with version 1.8.2 and upwards. I think it is connected to the fix of ZF-5800 (SVN r14667).

In my config.ini, i have something similar to the following:

 
foo.bar.1.bar=ff3f00
foo.bar.1.font=fefbf7
foo.bar.0.bar=ff2b00
foo.bar.0.font=ffff

But when i load this and convert it to an Array i get this:

 
    [foo] => Array
        (
            [bar] => Array
                (
                    [0] => Array
                        (
                          

                            [1] => Array
                                (
                                    [bar] => ff3f00
                                    [font] => fefbf7
                                )

                            [bar] => ff2b00
                            [font] => ffffff
                        )
                )
        )

Instead i would expect something like that:

 
    [foo] => Array
        (
            [bar] => Array
                (

                    [1] => Array
                        (
                            [bar] => ff3f00
                            [font] => fefbf7
                        )

                    [0] => Array
                        (
                            [bar] => ff2b00
                            [font] => ffffff
                        )  
                )
        )

The "real" code is a bit longer, but this is what it needs to be reproduced. When 0/zero is the last property name, i have no problem.

 
foo.bar.1=ff3f00
foo.bar.0=ff2b00

I think this is a bug, but easy to workaround by prefixing the numbers.

Comments

It seems this only happens because you have the index reversed (1 comes before 0 in your ini). A simple fix for you would be to put the 0 index first. I've attached a unit test that covers both variations.

This issue won't be fixed as there is the simple workaround of placing your index numbers in the correct order.