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

Escape trailing \ in QuestionHelper autocompletion#24660

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

Conversation

@kamazee
Copy link
Contributor

@kamazeekamazee commentedOct 22, 2017
edited
Loading

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#24652
LicenseMIT

Fixes#24652
Trailing backslash, being unescaped, used to escape closing formatting
tag and, thus, formatting tag appeared in autocompletion

Output of the added test without the fix:

./phpunit --filter testAutocompleteWithTrailingBackslash src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php#!/usr/bin/env phpPHPUnit 6.0.13 by Sebastian Bergmann and contributors.Testing Symfony\Component\Console\Tests\Helper\QuestionHelperTestF                                                                   1 / 1 (100%)Time: 4.28 seconds, Memory: 6.00MBThere was 1 failure:1) Symfony\Component\Console\Tests\Helper\QuestionHelperTest::testAutocompleteWithTrailingBackslashFailed asserting that two strings are equal.--- Expected+++ Actual@@ @@-'ExampleNamespace\'+'ExampleNamespace</hl>'

OutputFormatter::escapeTrailingBackslash is marked as@internal; however, this seems to be a valid use without exposing outside of the component.OutputFormatter::escape, which is not internal, doesn't fit here because escaping tags in autocompletion options is a deeper topic: there might be a valid use for tags in autocompletion and even if not, taking out the possibility to use them might be considered a BC break (even though it hasn't been advertised anywhere).

@kamazee
Copy link
ContributorAuthor

Oops, adding "BC Break" label must be a mistake (that's either me leaving BC Break row with "yes/no" when submitting PR or just mentioning BC break in PR description text). I'd appreciate it being removed.

@kamazee
Copy link
ContributorAuthor

Looks like CI consoles enable formatting. I'll do more cleanup for irrelevant sequences and update PR.

@kamazeekamazeeforce-pushed thefix_question_helper_autocompletion branch frome5015fa to1e66c9eCompareOctober 22, 2017 11:06
Fixessymfony#24652Trailing backslash, being unescaped, used to escape closing formattingtag and, thus, formatting tag appeared in autocompletion
@kamazeekamazeeforce-pushed thefix_question_helper_autocompletion branch from1e66c9e to0c0f1daCompareOctober 22, 2017 11:16
@kamazee
Copy link
ContributorAuthor

Ready for review.

@chalasrchalasr added this to the2.7 milestoneOct 23, 2017
$output->write("\0337");
// Write highlighted text
$output->write('<hl>'.substr($matches[$ofs],$i).'</hl>');
$output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs],$i)).'</hl>');
Copy link
Contributor

@ro0NLro0NLOct 24, 2017
edited
Loading

Choose a reason for hiding this comment

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

cant we useescape() here? (it includesescapeTrailingBackslash also) Not sure about leaking out this detail =/

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

As noted in the PR description, I think this is a BC break asescape would effectively turn off interpreting tags in autocompletion options (they'll be always shown as is); while the impact should not be terrible, this doesn't seem to be the right thing to do for anything but master where it could be acceptable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right!

they'll be always shown as is

Which is in fact the actual value.. no? But 👍 for keeping as is; thus escapeTrailingBackslash only.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@ro0NL , yeah.
I'd be glad to create another one for master with justescape as it indeed seems to be the right thing in general (interpretation of tags is not guaranteed there anyway, only<hl> accidentally works).

Copy link
Contributor

@ro0NLro0NLOct 24, 2017
edited
Loading

Choose a reason for hiding this comment

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

unless we qualify that a bugfix for 2.7 ;-) impact should be minimal. More or less relates to escaping exceptions#22142

alsoh1 leaks in as a valid style after calling... perhaps inline it using background/foreground options.

Copy link
Member

@chalasrchalasrOct 24, 2017
edited
Loading

Choose a reason for hiding this comment

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

I would keep it as is until someone asks for it, escaping trailing backslashes only

@nicolas-grekas
Copy link
Member

Thank you@kamazee.

@nicolas-grekasnicolas-grekas merged commit0c0f1da intosymfony:2.7Oct 24, 2017
nicolas-grekas added a commit that referenced this pull requestOct 24, 2017
This PR was merged into the 2.7 branch.Discussion----------Escape trailing \ in QuestionHelper autocompletion| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#24652| License       | MITFixes#24652Trailing backslash, being unescaped, used to escape closing formattingtag and, thus, formatting tag appeared in autocompletionOutput of the added test without the fix:```./phpunit --filter testAutocompleteWithTrailingBackslash src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php#!/usr/bin/env phpPHPUnit 6.0.13 by Sebastian Bergmann and contributors.Testing Symfony\Component\Console\Tests\Helper\QuestionHelperTestF                                                                   1 / 1 (100%)Time: 4.28 seconds, Memory: 6.00MBThere was 1 failure:1) Symfony\Component\Console\Tests\Helper\QuestionHelperTest::testAutocompleteWithTrailingBackslashFailed asserting that two strings are equal.--- Expected+++ Actual@@ @@-'ExampleNamespace\'+'ExampleNamespace</hl>'````OutputFormatter::escapeTrailingBackslash` is marked as `@internal`; however, this seems to be a valid use without exposing outside of the component. `OutputFormatter::escape`, which is not internal, doesn't fit here because escaping tags in autocompletion options is a deeper topic: there might be a valid use for tags in autocompletion and even if not, taking out the possibility to use them might be considered a BC break (even though it hasn't been advertised anywhere).Commits-------0c0f1da Escape trailing \ in QuestionHelper autocompletion
This was referencedOct 30, 2017
This was referencedNov 10, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@chalasrchalasrchalasr approved these changes

+1 more reviewer

@ro0NLro0NLro0NL left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

6 participants

@kamazee@nicolas-grekas@ro0NL@chalasr@ogizanagi@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp