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

Fixed the escaping of back slashes and << in console output#23730

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

Closed
javiereguiluz wants to merge3 commits intosymfony:2.7fromjaviereguiluz:fix_18481

Conversation

@javiereguiluz
Copy link
Member

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#18481
LicenseMIT
Doc PR-

Not sure if it's a valid solution, but this is my attempt to solve#18481.

$len =strlen($text);
$text =rtrim($text,'\\');
$text .=str_repeat('<<',$len -strlen($text));
$text .=str_repeat('\0',$len -strlen($text));

Choose a reason for hiding this comment

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

so, this relies on the fact that \0 is not printable, to use it as an escape character?
to be safe, what about removing\0 from $text also?

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that currently the PR does not use the null character but a backslash followed by a zero. Wouldn't it be better to actually use the null character ("\0" instead of'\0')?

nicolas-grekas, yceruto, and SpacePossum reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

tested with"\0" on 3.0.4 and seems to work, thanks@javiereguiluz for picking this up, much appreciated 👍 :)

@javiereguiluz
Copy link
MemberAuthor

Thanks for the reviews! I've fixed the error pointed out by@julienfalque. About this question from@nicolas-grekas:

to be safe, what about removing \0 from $text also?

I'm not sure I fully understand what you mean. Can you show me the code changes you want me to do? Thanks!

if ('\\' ===substr($text, -1)) {
$len =strlen($text);
$text =rtrim($text,'\\');
$text .=str_repeat('<<',$len -strlen($text));
Copy link
Member

@nicolas-grekasnicolas-grekasAug 29, 2017
edited
Loading

Choose a reason for hiding this comment

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

I meant this here:
$text = str_replace("\0", '', $text);
(or more generally: what happens/should happen when $text already has "\0" in it?)

javiereguiluz reacted with thumbs up emoji
@fabpot
Copy link
Member

Thank you@javiereguiluz.

fabpot added a commit that referenced this pull requestAug 29, 2017
…t (javiereguiluz)This PR was squashed before being merged into the 2.7 branch (closes#23730).Discussion----------Fixed the escaping of back slashes and << in console output| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#18481| License       | MIT| Doc PR        | -Not sure if it's a valid solution, but this is my attempt to solve#18481.Commits-------d5cb1fe Fixed the escaping of back slashes and << in console output
@fabpotfabpot closed thisAug 29, 2017
@fabpotfabpot mentioned this pull requestSep 11, 2017
This was referencedOct 5, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot approved these changes

@chalasrchalasrchalasr approved these changes

+2 more reviewers

@julienfalquejulienfalquejulienfalque left review comments

@SpacePossumSpacePossumSpacePossum 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.

8 participants

@javiereguiluz@fabpot@nicolas-grekas@julienfalque@chalasr@SpacePossum@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp