Issues

ZF-6960: constants in xml config file

Description

Its its not possible to use constants in the config xml, for example APPLICATION_PATH, to configure for example resources

for example this works in ini files:

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"

but in config xml it doesnt

APPLICATION_PATH "/Bootstrap.php"

Comments

Actualy, when using an ini file, parse_ini_file() is used. This function handles PHP constants contrary to simplexml_load_file() which does not. In order to add the constant support in Zend_Application when using xml files, Zend_Config_Xml must be rewrite.

That patch could make it. Let's Rob review it ;-)

Mind there is a typo in the patch , replace $this->_parseXMl() by $this->_parseXmlForPHPConstants() ; forgot to rename it.

-Will have a look soon. Ping me if I don't come back within a week!-

Update: looked!

Problem with patch is that it doesn't prevent constants in tag names and doesn't seem to handle concatenating constants within a string.

Imho that's not the way to go. I spoke with SpotSec about it already, and we think that you should include a namespace for inserting constants, so for example:


/Bootstrap.php

+1 for Bens suggestion.

This could also be used for further features later, such as XML includes (if it is decided to support them), and would add a consistend interface for such things.

I quite like Ben & SpotSec's proposal on the grounds that it is completely backwards compatible.

Also, we should put extends within the namespace for the future and check with Matthew about the namespace to use.

Finally, I'd like to see the patch :)

Partly patch to fix the issue. Not all unit tests included yet, no support for namespace:extends, no documentation. Will be finished and comitted to trunk after Rob reviewed it.

Patch looks okay to me.

Have pinged Matthew to a-okay the concept and URI before we go ahead and implement.

A namespace would simply be "http://framework.zend.com/Zend/Config" etc..., but it might be nice if "zf" was the default

</path,>

"Now, create your configuration. For this tutorial, we will use an INI style configuration; you may, of course, use an XML or PHP configuration file as well."

Please, remove this part from documentation until this issue will be fixed. I spent 1 hour to find out "why my XML config doesnt work.. they say it have!"

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

Is there any ETA on when this feature will be released? I just discovered about this and would definately like to see this happening soon.

I'm waiting for Matthew's okay and will then finish it.

For reference, resolved in svn 16924

Thx a lot for resolving this issue, great job!