Skip to content

[Console] Fixes "Incorrectly nested style tag found" error when using multi-line header content #46114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
----------------- ---------------------------------
Service ID .service_2
Class Full\Qualified\Class2
 Tags tag1 (attr1: val1, attr2: val2) 
 tag1 (attr3: val3) 
 tag2
Tags tag1 (attr1: val1, attr2: val2)
tag1 (attr3: val3)
tag2
Calls setMailer
Public no
Synthetic yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
----------------- ---------------------------------
Service ID -
Class Full\Qualified\Class2
 Tags tag1 (attr1: val1, attr2: val2) 
 tag1 (attr3: val3) 
 tag2
Tags tag1 (attr1: val1, attr2: val2)
tag1 (attr3: val3)
tag2
Calls setMailer
Public no
Synthetic yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
Autoconfigured no
Factory Class Full\Qualified\FactoryClass
Factory Method get
 Arguments Service(.definition_2) 
 %parameter% 
 Inlined Service 
 Array (3 element(s)) 
 Iterator (2 element(s)) 
 - Service(definition_1) 
 - Service(.definition_2)
Arguments Service(.definition_2)
%parameter%
Inlined Service
Array (3 element(s))
Iterator (2 element(s))
- Service(definition_1)
- Service(.definition_2)
---------------- -----------------------------

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
----------------- ---------------------------------
Service ID -
Class Full\Qualified\Class2
 Tags tag1 (attr1: val1, attr2: val2) 
 tag1 (attr3: val3) 
 tag2
Tags tag1 (attr1: val1, attr2: val2)
tag1 (attr3: val3)
tag2
Calls setMailer
Public no
Synthetic yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
| Requirements | name: [a-z]+ |
| Class | Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub |
| Defaults | name: Joseph |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
| | opt1: val1 |
| | opt2: val2 |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
| | opt1: val1 |
| | opt2: val2 |
+--------------+-------------------------------------------------------------------+
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
| Requirements | NO CUSTOM |
| Class | Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub |
| Defaults | NONE |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
| | opt1: val1 |
| | opt2: val2 |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
| | opt1: val1 |
| | opt2: val2 |
| Condition | context.getMethod() in ['GET', 'HEAD', 'POST'] |
+--------------+-------------------------------------------------------------------+
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/FrameworkBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"paragonie/sodium_compat": "^1.8",
"symfony/asset": "^3.4|^4.0|^5.0",
"symfony/browser-kit": "^4.3|^5.0",
"symfony/console": "^4.4.21|^5.0",
"symfony/console": "^4.4.42|^5.4.9",
"symfony/css-selector": "^3.4|^4.0|^5.0",
"symfony/dom-crawler": "^4.4.30|^5.3.7",
"symfony/dotenv": "^4.3.6|^5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Helper/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ private function buildTableRows(array $rows): TableRows
}
$escaped = implode("\n", array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode("\n", $cell)));
$cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped;
$lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
$lines = explode("\n", str_replace("\n", "<fg=default;bg=default></>\n", $cell));
foreach ($lines as $lineKey => $line) {
if ($colspan > 1) {
$line = new TableCell($line, ['colspan' => $colspan]);
Expand Down
24 changes: 22 additions & 2 deletions src/Symfony/Component/Console/Tests/Helper/TableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@ public function renderProvider()
'default',
<<<'TABLE'
+-------+------------+
| Dont break |
| here |
| Dont break |
| here |
+-------+------------+
| foo | Dont break |
| bar | here |
Expand Down Expand Up @@ -1078,6 +1078,26 @@ public function renderSetTitle()
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
+---------------+--------- Page 1/2 -------+------------------+

TABLE
,
true,
],
'header contains multiple lines' => [
'Multiline'."\n".'header'."\n".'here',
'footer',
'default',
<<<'TABLE'
+---------------+--- Multiline
header
here +------------------+
| ISBN | Title | Author |
+---------------+--------------------------+------------------+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
+---------------+---------- footer --------+------------------+

TABLE
],
[
Expand Down