10000 bug #38544 [DI] fix dumping env vars (nicolas-grekas) · symfony/symfony@75b3d17 · GitHub
[go: up one dir, main page]

Skip to content

Commit 75b3d17

Browse files
bug #38544 [DI] fix dumping env vars (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [DI] fix dumping env vars | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Forgotten in #35029 For 4.4 to reduce merge conflicts (it doesn't allow the new chars in 4.4 anyway, #35029 is still needed) Commits ------- 746a8d1 [DI] fix dumping env vars
2 parents a580688 + 746a8d1 commit 75b3d17

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ private function addDefaultParametersMethod(): string
14131413
$export = $this->exportParameters([$value]);
14141414
$export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2);
14151415

1416-
if (preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDir\.'')/", $export[1])) {
1416+
if (preg_match("/\\\$this->(?:getEnv\('(?:[-.\w]*+:)*+\w++'\)|targetDir\.'')/", $export[1])) {
14171417
$dynamicPhp[$key] = sprintf('%scase %s: $value = %s; break;', $export[0], $this->export($key), $export[1]);
14181418
} else {
14191419
$php[] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]);
@@ -1819,7 +1819,7 @@ private function dumpParameter(string $name): string
18191819
return $dumpedValue;
18201820
}
18211821

1822-
if (!preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDir\.'')/", $dumpedValue)) {
1822+
if (!preg_match("/\\\$this->(?:getEnv\('(?:[-.\w]*+:)*+\w++'\)|targetDir\.'')/", $dumpedValue)) {
18231823
return sprintf('$this->parameters[%s]', $this->doExport($name));
18241824
}
18251825
}

0 commit comments

Comments
 (0)
0