austinhyde/IniParser — pull request #7 by ehime (2013-04-18 16:54:45+00:00)
Title: IniParser does not understand how to handle empty arrays

In line 138 of the code, there is a fatal error thrown if you try to pass an empty iterating array value to IniParser, aka

foo[] = "val1"
foo[] = "val2"
foo[] = "val3"

PHP Warning: array_key_exists() expects parameter 2 to be array, string given in /var/www/Private/Cron/IniParser.php on line 138
PHP Fatal error: Cannot create references to/from string offsets nor overloaded objects in /var/www/Private/Cron/IniParser.php on line 145

This fix will turn the "empty arrays" into an empty incrementing array if it encounters a string value instead of the expected array value, this will provide you with an output of

[storage:ArrayObject:private] => Array
(
[foo] => Array
(
[0] => val1
[1] => val2
[2] => val3
)

)

allowing self incrementation on the chance that an empty array or string value is passed.

Jd Daniel :: Senior Applications Architect
Erado Messaging Solutions