Le 12/05/2011 20:16, Beau Simensen a écrit :
I found this pull request and it raised some questions for me as to how constant and server env are being handled:

https://github.com/symfony/symfony-docs/pull/273

I'm not sure how locked down the parameter stuff is yet, but I wanted to throw out a few ideas and see if they might be usable for Symfony 2. Mainly, could constants and env be allowed to also be specified as:

    * %CONSTANT:GLOBAL_CONSTANT%
    * %CONSTANT:My_Class::CONSTANT_NAME%
    * %ENV:Some_Env_Name%


This should be compatible with YAML (assuming constants do not work for YAML yet? there are no examples for using constant w/ YAML so I'm not sure it is supported...) and would reduce the reliance on (some) magic for getting information from $_SERVER in requiring fancily named vars that include SYMFONY__. One could just specify the exact environment name.

Another side effect of this might be that a type of constant is no longer required for XML. This would remove the need for temporary placeholders in the case that someone wanted to include a constant in a composed parameter value. Example:

    <parameter
    key="example.com.files.images.root">%CONSTANT:FILES_ROOT%/images</parameter>


vs.

    <parameter key="example.com.files.root"
    type="constant">%FILES_ROOT</parameter>
    <parameter
    
key="example.com.files.images.root">%example.com.files.root%/images</parameter>


... and if passed by way of $_SERVER:

    <!-- SetEnv EXAMPLE_FILES_ROOT /opt/example/storage/files -->
    <parameter
    
key="example.com.files.images.root">%ENV:EXAMPLE_FILES_ROOT%/images</parameter>


I would be happy to work on providing this functionality if there is support for the idea. I could leave support for the SYMFONY__ $_SERVER vars and the existing CONSTANT code but also include ENV: and CONSTANT: prefixes as an option for people to use.

The issue with the way you propose is the parameters set this way cannot come from anywhere else than the environment and that only parameters designed to come from the environment can be defined this way. this is a major limitation compared to the current way which allows you to redefine *any* parameter by using an environment variable.

--
Christophe | Stof

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to