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

Commit265d58a

Browse files
bug#46114 Fixes "Incorrectly nested style tag found" error when using multi-line header content (Perturbatio)
This PR was merged into the 4.4 branch.Discussion----------Fixes "Incorrectly nested style tag found" error when using multi-line header content| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| License | MITThis is intended to fix a bug identified as a result of usage in a separate package (hotmeteor/spectator#69 andhotmeteor/spectator#90).When a multi-line string is provided in the headers the Table helper produces content that cannot be rendered correctly.in `src/Symfony/Component/Console/Helper/Table.php` there's a line` $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell))` the exact line version varies between package versions, but this hasn't changed since 2017.What this seems to do when you pass a multi line terminal string is wrap the newlines in a default style tag, presumably to try to force a reset.But what happens in the headers is that it splits it so that each line after the first starts with the close tag and ends with the open, resulting in the incorrect nesting error. All this does is shift the newline character to after the reset style tag. A side-effect of this is that it appears to now pad out the content of the `compact` and `borderless` styles in a manner which (to me) appears to be the intended output i.e. spaces padded out to the full table width.Commits-------9e2306e [Console] Fixes "Incorrectly nested style tag found" error when using multi-line header content
2 parentsddfb4a8 +9e2306e commit265d58a

File tree

9 files changed

+46
-26
lines changed

9 files changed

+46
-26
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
----------------- ---------------------------------
99
Service ID .service_2
1010
Class Full\Qualified\Class2
11-
 Tags tag1 (attr1: val1, attr2: val2) 
12-
tag1 (attr3: val3)
13-
tag2
11+
Tags tag1 (attr1: val1, attr2: val2)
12+
tag1 (attr3: val3)
13+
tag2
1414
Calls setMailer
1515
Public no
1616
Synthetic yes

‎src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
----------------- ---------------------------------
44
Service ID -
55
Class Full\Qualified\Class2
6-
 Tags tag1 (attr1: val1, attr2: val2) 
7-
tag1 (attr3: val3)
8-
tag2
6+
Tags tag1 (attr1: val1, attr2: val2)
7+
tag1 (attr3: val3)
8+
tag2
99
Calls setMailer
1010
Public no
1111
Synthetic yes

‎src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.txt‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
Autoconfigured no
1414
Factory Class Full\Qualified\FactoryClass
1515
Factory Method get
16-
 Arguments Service(.definition_2)
17-
%parameter%
18-
Inlined Service
19-
Array (3 element(s))
20-
Iterator (2 element(s))
21-
- Service(definition_1)
22-
- Service(.definition_2)
16+
Arguments Service(.definition_2)
17+
%parameter%
18+
Inlined Service
19+
Array (3 element(s))
20+
Iterator (2 element(s))
21+
- Service(definition_1)
22+
- Service(.definition_2)
2323
---------------- -----------------------------
2424

‎src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_2.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
----------------- ---------------------------------
44
Service ID -
55
Class Full\Qualified\Class2
6-
 Tags tag1 (attr1: val1, attr2: val2) 
7-
tag1 (attr3: val3)
8-
tag2
6+
Tags tag1 (attr1: val1, attr2: val2)
7+
tag1 (attr3: val3)
8+
tag2
99
Calls setMailer
1010
Public no
1111
Synthetic yes

‎src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
| Requirements | name: [a-z]+ |
1212
| Class | Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub |
1313
| Defaults | name: Joseph |
14-
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
15-
| |opt1: val1 |
16-
| |opt2: val2 |
14+
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
15+
| |opt1: val1 |
16+
| |opt2: val2 |
1717
+--------------+-------------------------------------------------------------------+

‎src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
| Requirements | NO CUSTOM |
1212
| Class | Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub |
1313
| Defaults | NONE |
14-
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
15-
| |opt1: val1 |
16-
| |opt2: val2 |
14+
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
15+
| |opt1: val1 |
16+
| |opt2: val2 |
1717
| Condition | context.getMethod() in ['GET', 'HEAD', 'POST'] |
1818
+--------------+-------------------------------------------------------------------+

‎src/Symfony/Bundle/FrameworkBundle/composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"paragonie/sodium_compat":"^1.8",
3838
"symfony/asset":"^3.4|^4.0|^5.0",
3939
"symfony/browser-kit":"^4.3|^5.0",
40-
"symfony/console":"^4.4.21|^5.0",
40+
"symfony/console":"^4.4.42|^5.4.9",
4141
"symfony/css-selector":"^3.4|^4.0|^5.0",
4242
"symfony/dom-crawler":"^4.4.30|^5.3.7",
4343
"symfony/dotenv":"^4.3.6|^5.0",

‎src/Symfony/Component/Console/Helper/Table.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ private function buildTableRows(array $rows): TableRows
586586
}
587587
$escaped =implode("\n",array_map([OutputFormatter::class,'escapeTrailingBackslash'],explode("\n",$cell)));
588588
$cell =$cellinstanceof TableCell ?newTableCell($escaped, ['colspan' =>$cell->getColspan()]) :$escaped;
589-
$lines =explode("\n",str_replace("\n","<fg=default;bg=default>\n</>",$cell));
589+
$lines =explode("\n",str_replace("\n","<fg=default;bg=default></>\n",$cell));
590590
foreach ($linesas$lineKey =>$line) {
591591
if ($colspan >1) {
592592
$line =newTableCell($line, ['colspan' =>$colspan]);

‎src/Symfony/Component/Console/Tests/Helper/TableTest.php‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,8 @@ public function renderProvider()
615615
'default',
616616
<<<'TABLE'
617617
+-------+------------+
618-
[39;49m| [39;49m[37;41mDont break[39;49m[39;49m |[39;49m
619-
[39;49m| [39;49m[37;41mhere[39;49m |
618+
[37;41m| [39;49m[37;41mDont break[39;49m[37;41m |[39;49m
619+
[37;41m| here[39;49m |
620620
+-------+------------+
621621
| foo | Dont break |
622622
| bar | here |
@@ -1078,6 +1078,26 @@ public function renderSetTitle()
10781078
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
10791079
+---------------+--------- Page 1/2 -------+------------------+
10801080

1081+
TABLE
1082+
,
1083+
true,
1084+
],
1085+
'header contains multiple lines' => [
1086+
'Multiline'."\n".'header'."\n".'here',
1087+
'footer',
1088+
'default',
1089+
<<<'TABLE'
1090+
+---------------+--- Multiline
1091+
header
1092+
here +------------------+
1093+
| ISBN | Title | Author |
1094+
+---------------+--------------------------+------------------+
1095+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
1096+
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
1097+
| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
1098+
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
1099+
+---------------+---------- footer --------+------------------+
1100+
10811101
TABLE
10821102
],
10831103
[

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp