Skip to content

Commit f292a6a

Browse files
committed
Merge branch '6.3' into 6.4
* 6.3: fix merge [VarDumper] Test intl formatter broken since dumper does not replace the nnbsp character by standard space [WebProfilerBundle] Fix intercept external redirects [Webhook] Added missing XML attribute in config XSD [String] Skip a test when an issue is detected in PCRE2 [ExpressionLanguage] Fix null coalescing propagation [Mailer] Stop using the (local) AWS shared configuration in the PHPUnit tests. detect colors on not windows fix xterm detection refactor: hyper check Missing translations for Slovak (sk) #51954 Remove redundant PHPdoc line properly handle SYMFONY_DOTENV_VARS being the empty string Avoid incompatibility with symfony/console 7 bug #45057 [Messenger] Avoid reconnecting active Redis connections. [HttpKernel] Catch `TypeError` if the wrong type is used in `BackedEnumValueResolver` [Serializer] fix regression where nullable int cannot be serialized do not overwrite an application's default serialization context
2 parents d0d584a + 73d4b31 commit f292a6a

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Command/DebugCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,13 @@ private function getVariables(array $envFiles, ?string $nameFilter): array
151151

152152
private function getAvailableVars(): array
153153
{
154-
$vars = explode(',', $_SERVER['SYMFONY_DOTENV_VARS'] ?? '');
154+
$dotenvVars = $_SERVER['SYMFONY_DOTENV_VARS'] ?? '';
155+
156+
if ('' === $dotenvVars) {
157+
return [];
158+
}
159+
160+
$vars = explode(',', $dotenvVars);
155161
sort($vars);
156162

157163
return $vars;

Tests/Command/DebugCommandTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class DebugCommandTest extends TestCase
2727
*/
2828
public function testErrorOnUninitializedDotenv()
2929
{
30+
unset($_SERVER['SYMFONY_DOTENV_VARS']);
31+
3032
$command = new DebugCommand('dev', __DIR__.'/Fixtures/Scenario1');
3133
$command->setHelperSet(new HelperSet([new FormatterHelper()]));
3234
$tester = new CommandTester($command);
@@ -36,6 +38,30 @@ public function testErrorOnUninitializedDotenv()
3638
$this->assertStringContainsString('[ERROR] Dotenv component is not initialized', $output);
3739
}
3840

41+
/**
42+
* @runInSeparateProcess
43+
*/
44+
public function testEmptyDotEnvVarsList()
45+
{
46+
$_SERVER['SYMFONY_DOTENV_VARS'] = '';
47+
48+
$command = new DebugCommand('dev', __DIR__.'/Fixtures/Scenario1');
49+
$command->setHelperSet(new HelperSet([new FormatterHelper()]));
50+
$tester = new CommandTester($command);
51+
$tester->execute([]);
52+
$expectedFormat = <<<'OUTPUT'
53+
%a
54+
---------- ------- ------------ ------%S
55+
Variable Value .env.local .env%S
56+
---------- ------- ------------ ------%S
57+
58+
// Note that values might be different between web and CLI.%S
59+
%a
60+
OUTPUT;
61+
62+
$this->assertStringMatchesFormat($expectedFormat, $tester->getDisplay());
63+
}
64+
3965
public function testScenario1InDevEnv()
4066
{
4167
$output = $this->executeCommand(__DIR__.'/Fixtures/Scenario1', 'dev');

0 commit comments

Comments
 (0)