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

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:4.4fromPerturbatio:fix-multiline-headers-in-console-table
May 14, 2022
Merged

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

nicolas-grekas merged 1 commit intosymfony:4.4fromPerturbatio:fix-multiline-headers-in-console-table
May 14, 2022

Conversation

@Perturbatio
Copy link
Contributor

@PerturbatioPerturbatio commentedApr 19, 2022
edited by nicolas-grekas
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
LicenseMIT

This 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.

insrc/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 thecompact andborderless styles in a manner which (to me) appears to be the intended output i.e. spaces padded out to the full table width.

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.1 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@stofstof changed the base branch from6.0 to6.1April 19, 2022 15:25
@PerturbatioPerturbatio changed the base branch from6.1 to6.0April 19, 2022 15:26
@stof
Copy link
Member

I changed the target branch to 6.1 as that's what your branch is currently based on, allowing to have a clean diff.

The expected target of the bugfix (which will require rebasing the git branch, not only editing the PR metadata) is either 4.4 or 5.4 (depending on whether 4.4 is affected, which is probably the case as you said that this code hasn't changed since 2017). But there is no chance that the lowest affected version is 6.0

@stofstof changed the base branch from6.0 to6.1April 19, 2022 15:29
@Perturbatio
Copy link
ContributorAuthor

I changed the target branch to 6.1 as that's what your branch is currently based on, allowing to have a clean diff.

The expected target of the bugfix (which will require rebasing the git branch, not only editing the PR metadata) is either 4.4 or 5.4 (depending on whether 4.4 is affected, which is probably the case as you said that this code hasn't changed since 2017). But there is no chance that the lowest affected version is 6.0

Yeah, I think I'm misunderstanding where to branch from , It's not difficult to create a patch for this since it's such a tiny change. Is there a branch Ishould be creating this from to PR into?

@stof
Copy link
Member

@Perturbatio if the lowest affected maintained version is 4.4 (which is likely the case for this bug), the fix needs to be applied to 4.4. The easiest for that is to create your branch directly from the 4.4 branch. But you can still change that after the fact with a rebase. Seehttps://symfony.com/doc/current/contributing/code/pull_requests.html#rebase-your-pull-request (be careful about the last step requiring a force push, not a merge of the upstream feature branch, which is a common mistake done when following that doc not carefully)

@PerturbatioPerturbatio changed the base branch from6.1 to4.4April 19, 2022 17:10
@Perturbatio
Copy link
ContributorAuthor

Perturbatio commentedApr 20, 2022
edited
Loading

@stof The current set of failing tests (TextDescriptorTest) pass locally, but in GitHub (only in
PHPUnit / Tests (8.1, low-deps) (pull_request) ), they don't seem to have any expected value. Is there something that might prevent the tests from reading data from the fixtures for this specific test run?

@PerturbatioPerturbatio requested a review fromstofApril 22, 2022 08:41
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please revert all unrelated CS changes, so that the PR is focused on one topic.

@lyrixxlyrixx removed their request for reviewMay 10, 2022 12:23
@nicolas-grekasnicolas-grekas changed the titleFixes "Incorrectly nested style tag found" error when using multi-line…Fixes "Incorrectly nested style tag found" error when using multi-line header contentMay 14, 2022
@nicolas-grekasnicolas-grekas modified the milestones:6.0,4.4May 14, 2022
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

(I reverted the not-needed CS changes)

@carsonbotcarsonbot changed the titleFixes "Incorrectly nested style tag found" error when using multi-line header content[Console] Fixes "Incorrectly nested style tag found" error when using multi-line header contentMay 14, 2022
@nicolas-grekas
Copy link
Member

Thank you@Perturbatio.

@nicolas-grekasnicolas-grekas merged commit265d58a intosymfony:4.4May 14, 2022
@fabpotfabpot mentioned this pull requestMay 14, 2022
@PerturbatioPerturbatio deleted the fix-multiline-headers-in-console-table branchMay 17, 2022 08:27
This was referencedMay 27, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@xabbuhxabbuhAwaiting requested review from xabbuh

@dunglasdunglasAwaiting requested review from dunglas

@ycerutoycerutoAwaiting requested review from yceruto

@wouterjwouterjAwaiting requested review from wouterj

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@jderussejderusseAwaiting requested review from jderusse

@stofstofAwaiting requested review from stof

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

4 participants

@Perturbatio@carsonbot@stof@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp