From 6b6c24c6187b5fe19b9c0aa230432a846d212081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Sun, 7 Apr 2019 20:27:31 +0200 Subject: [PATCH] Allow env processor to resolve `::` --- .../ParameterBag/EnvPlaceholderParameterBag.php | 2 +- .../Tests/ParameterBag/EnvPlaceholderParameterBagTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php index 200351bf42..fe27324e54 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php @@ -42,7 +42,7 @@ class EnvPlaceholderParameterBag extends ParameterBag return $placeholder; // return first result } } - if (!preg_match('/^(?:\w++:)*+\w++$/', $env)) { + if (!preg_match('/^(?:\w*+:)*+\w++$/', $env)) { throw new InvalidArgumentException(sprintf('Invalid %s name: only "word" characters are allowed.', $name)); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php index b245823f67..999303017c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php @@ -194,4 +194,11 @@ class EnvPlaceholderParameterBagTest extends TestCase $bag->get('env(ARRAY_VAR)'); $bag->resolve(); } + + public function testDefaultToNullAllowed() + { + $bag = new EnvPlaceholderParameterBag(); + $bag->resolve(); + $this->assertNotNull($bag->get('env(default::BAR)')); + } }