8000 bug #30990 Allow env processor to resolve `::` (jderusse) · symfony/symfony@408e4aa · GitHub
[go: up one dir, main page]

Skip to content

Commit 408e4aa

Browse files
bug #30990 Allow env processor to resolve :: (jderusse)
This PR was merged into the 4.3-dev branch. Discussion ---------- Allow env processor to resolve `::` | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | N/A The env processor resolve to null when no fallback are provided. ie. `env(default::NOT_EXISTS)` Issue is that the regexp does not allow such pattern. thus made the feature unusable. Commits ------- 6b6c24c Allow env processor to resolve `::`
2 parents 2efd7b2 + 6b6c24c commit 408e4aa

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function get($name)
4242
return $placeholder; // return first result
4343
}
4444
}
45-
if (!preg_match('/^(?:\w++:)*+\w++$/', $env)) {
45+
if (!preg_match('/^(?:\w*+:)*+\w++$/', $env)) {
4646
throw new InvalidArgumentException(sprintf('Invalid %s name: only "word" characters are allowed.', $name));
4747
}
4848

src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,11 @@ public function testGetThrowsOnBadDefaultValue()
194194
$bag->get('env(ARRAY_VAR)');
195195
$bag->resolve();
196196
}
197+
198+
public function testDefaultToNullAllowed()
199+
{
200+
$bag = new EnvPlaceholderParameterBag();
201+
$bag->resolve();
202+
$this->assertNotNull($bag->get('env(default::BAR)'));
203+
}
197204
}

0 commit comments

Comments
 (0)
0