bug #26112 Env var maps to undefined constant. (dsmink)
This PR was submitted for the master branch but it was merged into the 3.4 branch instead (closes #26112).
Discussion
----------
Env var maps to undefined constant.
When I try to use a constant as an environment variable, as described in the blog item,
I run into the following problem.
Env var "SOME_CONST" maps to undefined constant "App\\Util\\SomeClass::SOME_CONST".
The proposed solution works for me, however, I'm not sure if this is the best and conform Symfony standards.
Blog:
https://symfony.com/blog/new-in-symfony-3-4-advanced-environment-variables
| Q | A
| ------------- | ---
| Branch? | master for features / 2.7 up to 4.0 for bug fixes <!-- see below -->
| Bug fix? | yes/no
| New feature? | yes/no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | yes/no
| Deprecations? | yes/no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass? | yes/no
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Replace this comment by a description of what your PR is solving.
-->
Commits
-------
bdf9efc
Env var maps to undefined constant.
This commit is contained in:
commit
0c4b32c74b
@ -114,7 +114,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
|||||||
throw new RuntimeException(sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env));
|
throw new RuntimeException(sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env));
|
||||||
}
|
}
|
||||||
|
|
||||||
return constant($name);
|
return constant($env);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('base64' === $prefix) {
|
if ('base64' === $prefix) {
|
||||||
|
Reference in New Issue
Block a user