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

Posted by Florent Cailhol (ooflorent) on 2009-06-11T03:23:43.000+0000

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.

Posted by julien PAULI (doctorrock83) on 2009-06-12T12:50:29.000+0000

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

Posted by julien PAULI (doctorrock83) on 2009-06-12T12:54:38.000+0000

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

Posted by Rob Allen (rob) on 2009-06-16T03:41:48.000+0000

-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.

Posted by Ben Scholzen (dasprid) on 2009-06-16T03:47:56.000+0000

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

Posted by Ryan Mauger (bittarman) on 2009-06-16T03:59:10.000+0000

+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.

Posted by Rob Allen (rob) on 2009-06-16T03:59:25.000+0000

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 :)

Posted by Ben Scholzen (dasprid) on 2009-06-16T07:20:26.000+0000

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.

Posted by Rob Allen (rob) on 2009-06-21T12:13:11.000+0000

Patch looks okay to me.

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

Posted by Geoffrey Tran (potatobob) on 2009-06-21T13:43:02.000+0000

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

</path,>

Posted by Lex Viatkin (viatkine) on 2009-06-28T16:09:03.000+0000

"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!"