Issues

ZF-5630: Zend_Config_Ini examples are wrong

Description

In several places you see this example:

$options['nestSeparator'] = ':'; $config = new Zend_Config_Ini('/path/to/config.ini', 'staging', $options);

Followed by this example ini code:

; Production site configuration data [production] webhost = www.example.com database.adapter = pdo_mysql database.params.host = db.example.com database.params.username = dbuser database.params.password = secret database.params.dbname = dbname

However, when the user follows this example literally, the resulting $config object is not correctly populated. For instance:

echo $config->database->params->host

Results in Notice: Trying to get property of non-object in

Changing the nestSeparator character to a dot (which is the character used in the ini sample above, results in a correctly populated config object.

This is prevelant in these pages:

http://framework.zend.com/manual/en/…

For new users this could be very frustrating and lead them to believe it's a bug in Zend code.

Comments

I can see why the documentation can be confusing, but I actually don't think it's wrong.

The first 3 lines of code you write is just an example of how you can change the "nestSeparator"-option, while the sample ini code is an example in general. The "nestSeparator" defaults to a dot "." and that should work correctly with the sample ini code.

At least that's how I read it, but I agree that it could be written (and visualised) better :).

Not an issue, as the example on http://framework.zend.com/manual/en/… has the code under the INI file that correctly uses the dot separator.

It would be nice if a "note" in the docs was visually separated with a border though.