ZF-11814: Remember meta info (link file name and line number) per config option


I have problems with a navigation.ini file throwing errors, but it is not possible to go from the config option back to the line of the ini file that caused the error:…

Could this info be saved as part of the option?


Hello monk e boy, you never get the line number with the error:

cms.paes.ntro.lael      = Edit
cms.pags.intr.moule     = admin
cm.pages.into.controler = cms
cms.paes.intro.ation    = editor

This is a correct file, because there is no error in the ini syntax! {{Zend_Config}} ({{parse_ini_file}}) works without problems.

Only if the ini syntax is wrong, then you get an error:

cms.pages.intro.label = Edit


Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'syntax error, unexpected '!' in foo.ini on line 3

So you can see, there is no chance to get a line number, if no syntax error is present.

From the example on:…

Why can't I do:

$config = new Zend_Config_Ini('/path/to/config.ini', 'staging');
echo $config->database->params->host; // prints "" echo $config->database->params->dbname; // prints "dbname" // PROPOSED CHANGES: echo $config->database->params->host->meta; // prints "/path/to/config.ini, line 44"

Then this could be used to fix the other bug linked in my first comment.


Sorry, I should have mentioned that Zend_Config_Ini would have to save this info somewhere (or calculate it when it's needed)


Prints the error message:

Notice: Trying to get property of non-object in /…/foo.php on line 9 ```

// PROPOSED CHANGES: echo $config->database->params->host->meta; // prints "/path/to/config.ini, line 44"

Look, it's not rocket science. Just store the file name and line number with each item in the Config. I propose the attribute in the config item is called 'meta' but feel free to call it what you like.

As an optimisation you could normalize the data a bit.


The current operation of Zend_Config is that $config->b doesn't generate any errors if b doesn't exit. (though $config->a->b will do as Frank notes). Any change to this behaviour has to be added as a configurable option as we cannot break B/C on ZF 1.

If we are going to generate an error message on property not found, then it should be an Exception, not an echoed message.

If you have signed the CLA, please provide a patch that meets these criteria.

I'm interrested in