ZF-6960: constants in xml config file

Issue Type: Bug Created: 2009-06-09T00:50:12.000+0000 Last Updated: 2009-08-03T05:18:44.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Weber Chris (chrisweb) Assignee: Ben Scholzen (dasprid) Tags: - Zend_Config

Related issues: Attachments: - patch.patch


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"


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:

<pre class="highlight">

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 "" etc..., but it might be nice if "zf" was the default


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

Posted by Aron Rotteveel (arondeparon) on 2009-07-01T03:05:15.000+0000

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.

Posted by Ben Scholzen (dasprid) on 2009-07-01T03:15:56.000+0000

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

Posted by Rob Allen (rob) on 2009-07-21T14:29:12.000+0000

For reference, resolved in svn 16924

Posted by Weber Chris (chrisweb) on 2009-08-03T05:18:44.000+0000

Thx a lot for resolving this issue, great job!

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.