Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24d9c2f

Browse files
committed
Show the first actual unsupported character in the error message
1 parent642374f commit24d9c2f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

‎src/Symfony/Component/Dotenv/.env‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/Symfony/Component/Dotenv/Dotenv.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,9 @@ private function resolveVariables($value)
458458
}
459459

460460
if ('' ===$value &&isset($matches['default_value'])) {
461-
if (false !==strpbrk($matches['default_value'],'\'"{$')) {
462-
throw$this->createFormatException(sprintf('Unsupported character found in the default value of variable "$%s".',$name));
461+
$unsupportedChars =strpbrk($matches['default_value'],'\'"{$');
462+
if (false !==$unsupportedChars) {
463+
throw$this->createFormatException(sprintf('Unsupported character "%s" found in the default value of variable "$%s".',$unsupportedChars[0],$name));
463464
}
464465

465466
$value =substr($matches['default_value'],2);

‎src/Symfony/Component/Dotenv/Tests/DotenvTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public function getEnvDataWithFormatErrors()
4848
['FOO!',"Missing = in the environment variable declaration in\".env\" at line 1.\n...FOO!...\n ^ line 1 offset 3"],
4949
['FOO=$(echo foo',"Missing closing parenthesis. in\".env\" at line 1.\n...FOO=$(echo foo...\n ^ line 1 offset 14"],
5050
['FOO=$(echo foo'."\n","Missing closing parenthesis. in\".env\" at line 1.\n...FOO=$(echo foo\\n...\n ^ line 1 offset 14"],
51-
["FOO=\nBAR=\${FOO:-\'a{a}a}","Unsupported character found in the default value of variable\"\$FOO\". in\".env\" at line 2.\n...\\nBAR=\${FOO:-\'a{a}a}...\n ^ line 2 offset 24"],
52-
["FOO=\nBAR=\${FOO:-a\$a}","Unsupported character found in the default value of variable\"\$FOO\". in\".env\" at line 2.\n...FOO=\\nBAR=\${FOO:-a\$a}...\n ^ line 2 offset 20"],
51+
["FOO=\nBAR=\${FOO:-\'a{a}a}","Unsupported character\"'\"found in the default value of variable\"\$FOO\". in\".env\" at line 2.\n...\\nBAR=\${FOO:-\'a{a}a}...\n ^ line 2 offset 24"],
52+
["FOO=\nBAR=\${FOO:-a\$a}","Unsupported character\"\$\"found in the default value of variable\"\$FOO\". in\".env\" at line 2.\n...FOO=\\nBAR=\${FOO:-a\$a}...\n ^ line 2 offset 20"],
5353
["FOO=\nBAR=\${FOO:-a\"a}","Unclosed braces on variable expansion in\".env\" at line 2.\n...FOO=\\nBAR=\${FOO:-a\"a}...\n ^ line 2 offset 17"],
5454
];
5555

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp