Symfony version(s) affected
6.4
Description
https://github.com/symfony/symfony/blob/8.1/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php states that environment variables name can contain:
letters, digits, hyphens, backslashes and colons
NB: Support for dots have also been added recently (94182c8).
Turns out, hyphens are not supported. Since 6.4 at least.
How to reproduce
Checkout to branch 6.4 and add the following test in src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php:
public function testHyphensAllowed()
{
$bag = new EnvPlaceholderParameterBag();
$this->expectException(InvalidArgumentException::class);
$bag->get('env(foo-bar)');
}
Possible Solution
Now, the question is: do we aim to fix this behavior (and actually support it), or fix the error message?
Additional Context
No response
Symfony version(s) affected
6.4
Description
https://github.com/symfony/symfony/blob/8.1/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php states that environment variables name can contain:
NB: Support for dots have also been added recently (94182c8).
Turns out, hyphens are not supported. Since 6.4 at least.
How to reproduce
Checkout to branch 6.4 and add the following test in
src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php:Possible Solution
Now, the question is: do we aim to fix this behavior (and actually support it), or fix the error message?
Additional Context
No response