Skip to content

Commit 0c4b32c

Browse files
bug symfony#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 symfony#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.
2 parents a41874f + bdf9efc commit 0c4b32c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/DependencyInjection/EnvVarProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
114114
throw new RuntimeException(sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env));
115115
}
116116

117-
return constant($name);
117+
return constant($env);
118118
}
119119

120120
if ('base64' === $prefix) {

0 commit comments

Comments
 (0)