-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Open
Description
Symfony version(s) affected
7.3.1
Description
I have the following table. This table is used to write Logmessages to specfic Logfiles. To make these more readable, the last column is very long.
$table = new Table($output);
$table->setStyle('box');
$table->setColumnMaxWidth(0, 20);
$table->setColumnMaxWidth(1, 20);
$table->setColumnMaxWidth(2, 220);
$table->setColumnWidths([20, 20, 220]);
$table->setHeaders([
[new TableCell('General Info', ['colspan' => 3])],
]);
$table->addRow(
[
new TableCell(
'Time',
['style' => new TableCellStyle(['align' => 'right'])],
),
new TableCell(
'2025-07-19T18:29:55+00:00',
['colspan' => 2],
),
],
);
$table->addRow(
[
new TableCell(
'Level',
['style' => new TableCellStyle(['align' => 'right'])],
),
new TableCell(
'Error',
['colspan' => 2],
),
],
);
$table->addRow(new TableSeparator());
$table->addRow(
[new TableCell('Extra', ['colspan' => 3])],
);
$table->addRow(new TableSeparator());
$table->addRow(
[
new TableCell('app', ['style' => new TableCellStyle(['align' => 'right'])]),
new TableCell(
'test-app',
['colspan' => 2],
),
],
);
$table->addRow(new TableSeparator());
$table->addRow(
[new TableCell('Context', ['colspan' => 3])],
);
$table->addRow(new TableSeparator());
$table->addRow(
[
new TableCell('one', ['style' => new TableCellStyle(['align' => 'right'])]),
new TableCell(
'null',
['colspan' => 2],
),
],
);
$table->addRow(
[
new TableCell('five', ['style' => new TableCellStyle(['align' => 'right'])]),
new TableCell(
'test1 test2 test3 test4',
['colspan' => 2],
),
],
);
$table->addRow(
[
new TableCell('five', ['style' => new TableCellStyle(['align' => 'right'])]),
new TableCell(
'test1 test2 test3 test4',
['colspan' => 2],
),
],
);
$table->addRow(
[
new TableCell(
'six',
[
'style' => new TableCellStyle(
['align' => 'right'],
),
],
),
new TableCell(
'stdClass',
),
new TableCell(
'{"a":"test-channel","b":"test message\\rtest message 2\\ntest message 3\\r\\ntest message 4"}',
),
],
);
$table->addRow(
[
new TableCell(
'seven',
[
'style' => new TableCellStyle(
['align' => 'right'],
),
],
),
new TableCell(
'test message 5\rtest message 6\ntest message 7\r\ntest message 8',
['colspan' => 2],
),
],
);
Until version 7.3.0 the following output generated
+----------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| General Info |
+----------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Time | 2025-07-19T18:29:55+00:00 |
| Level | ERROR |
+----------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Extra |
+----------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| app | test-app |
+----------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Context |
+----------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| one | null |
| five | test1 test2 test3 test4 |
| six | stdClass | {"a":"test-channel","b":"test message\\rtest message 2\\ntest message 3\\r\\ntest message 4"} |
| seven | test message 5\rtest message 6\ntest |
| | message 7\r\ntest message 8 |
+----------------------+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
With version 7.3.1 the following output is generated
+------------+----------------------+-----------------------------------------------------------------------------------------------+
| General Info |
+------------+----------------------+-----------------------------------------------------------------------------------------------+
| Time | 2025-07-19T18:29:55+00:00 |
| Level | Error |
+------------+----------------------+-----------------------------------------------------------------------------------------------+
| Extra |
+------------+----------------------+-----------------------------------------------------------------------------------------------+
| app | test-app |
+------------+----------------------+-----------------------------------------------------------------------------------------------+
| Context |
+------------+----------------------+-----------------------------------------------------------------------------------------------+
| one | null |
| five | test1 test2 test3 test4 |
| six | stdClass | {"a":"test-channel","b":"test message\\rtest message 2\\ntest message 3\\r\\ntest message 4"} |
| seven | test message 5\rtest message 6\ntest message 7\r\ntest message 8 |
+------------+----------------------+-----------------------------------------------------------------------------------------------+
The configured column width is ignored for the first and the last column.
How to reproduce
Please see the description.
Possible Solution
No response
Additional Context
No response