8000 bug #49651 [DependencyInjection] Fix support binary values in paramet… · symfony/symfony@48f806a · GitHub
[go: up one dir, main page]

Skip to content

Commit 48f806a

Browse files
bug #49651 [DependencyInjection] Fix support binary values in parameters. (vtsykun)
This PR was merged into the 5.4 branch. Discussion ---------- [DependencyInjection] Fix support binary values in parameters. | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #49638 | License | MIT | Doc PR | - This issue related to #25928 ### Step to reproduce 1. Add parameter like this ```yaml parameters: banner_message: "\e[37;44m#StandWith\e[30;43mUkraine\e[0m" ``` 2. Run command `debug:router` Actual result: ![Selection_1343](https://user-images.githubusercontent.com/21358010/224194622-6d814bbc-823d-43db-8e11-43a46f09ad57.png) Commits ------- 8541643 Fix support binary values in parameters.
2 parents f2ccff6 + 8541643 commit 48f806a

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ private function convertParameters(array $parameters, string $type, \DOMElement
320320
$element->setAttribute('type', 'expression');
321321
$text = $this->document->createTextNode(self::phpToXml((string) $value));
322322
$element->appendChild($text);
323-
} elseif (\is_string($value) && !preg_match('/^[^\x00-\x08\x0B\x0E-\x1A\x1C-\x1F\x7F]*+$/u', $value)) {
323+
} elseif (\is_string($value) && !preg_match('/^[^\x00-\x08\x0B\ 10000 x0C\x0E-\x1F\x7F]*+$/u', $value)) {
324324
$element->setAttribute('type', 'binary');
325325
$text = $this->document->createTextNode(self::phpToXml(base64_encode($value)));
326326
$element->appendChild($text);

src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
'bar' => 'foo is %%foo bar',
1010
'escape' => '@escapeme',
1111
'values' => [true, false, null, 0, 1000.3, 'true', 'false', 'null'],
12+
'utf-8 valid string' => "\u{021b}\u{1b56}\ttest",
1213
'binary' => "\xf0\xf0\xf0\xf0",
1314
'binary-control-char' => "This is a Bell char \x07",
15+
'console banner' => "\e[37;44m#StandWith\e[30;43mUkraine\e[0m",
1416
'null string' => 'null',
1517
'string of digits' => '123',
1618
'string of digits prefixed with minus character' => '-123',

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ protected function getDefaultParameters(): array
106106
6 => 'false',
107107
7 => 'null',
108108
],
109+
'utf-8 valid string' => 'ț᭖ test',
109110
'binary' => 'ðððð',
110111
'binary-control-char' => 'This is a Bell char ',
112+
'console banner' => '#StandWithUkraine',
111113
'null string' => 'null',
112114
'string of digits' => '123',
113115
'string of digits prefixed with minus character' => '-123',

src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
<parameter type="string">false</parameter>
1919
<parameter type="string">null</parameter>
2020
</parameter>
21+
<parameter key="utf-8 valid string">&#x21B;&#x1B56; test</parameter>
2122
<parameter key="binary" type="binary">8PDw8A==</parameter>
2223
<parameter key="binary-control-char" type="binary">VGhpcyBpcyBhIEJlbGwgY2hhciAH</parameter>
24+
<parameter key="console banner" type="binary">G1szNzs0NG0jU3RhbmRXaXRoG1szMDs0M21Va3JhaW5lG1swbQ==</parameter>
2325
<parameter key="null string" type="string">null</parameter>
2426
<parameter key="string of digits" type="string">123</parameter>
2527
<parameter key="string of digits prefixed with minus character" type="string">-123</parameter>

src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ parameters:
44
bar: 'foo is %%foo bar'
55
escape: '@@escapeme'
66
values: [true, false, null, 0, 1000.3, 'true', 'false', 'null']
7+
utf-8 valid string: "ț᭖\ttest"
78
binary: !!binary 8PDw8A==
89
binary-control-char: !!binary VGhpcyBpcyBhIEJlbGwgY2hhciAH
10+
console banner: "\e[37;44m#StandWith\e[30;43mUkraine\e[0m"
911
null string: 'null'
1012
string of digits: '123'
1113
string of digits prefixed with minus character: '-123'

0 commit comments

Comments
 (0)
0