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

[DI] Fix possible incorrect php-code when dumped strings contains newlines#24532

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

Conversation

@Strate
Copy link
Contributor

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

See discussion#24517

@nicolas-grekas
Copy link
Member

I think you can still create a simple test case that uses a "\n" and ensure the dumped result is OK (without trying to actually fit that with the case where it is required).

@Strate
Copy link
ContributorAuthor

@nicolas-grekas done

$cleanParts =explode("\n",$value);
$cleanParts =array_map(function ($part) {returnvar_export($part,true); },$cleanParts);

returnimplode(' . "\n" .',$cleanParts);

Choose a reason for hiding this comment

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

spaces around dots should be remove I think, per our CS policy.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@nicolas-grekas sure, already done.

@Strate
Copy link
ContributorAuthor

Some optimizations could be done, for example now string like"\n\n\n" dumped as''."\n".''."\n".''."\n".''. Is it reasonable to improve that case?

@nicolas-grekas
Copy link
Member

PHP 7 will concat at compile time, so no need IMHO.

@nicolas-grekasnicolas-grekas added this to the2.7 milestoneOct 12, 2017
@stof
Copy link
Member

Sovar_export does not play well with them ? what about\r then ?

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedOct 12, 2017
edited
Loading

\r is fine because the real issue is "explode" in "wrapServiceConditionals", which re-indents the code at\n points only.

@nicolas-grekas
Copy link
Member

Thank you@Strate.

nicolas-grekas added a commit that referenced this pull requestOct 12, 2017
…ontains newlines (Strate)This PR was squashed before being merged into the 2.7 branch (closes#24532).Discussion----------[DI] Fix possible incorrect php-code when dumped strings contains newlines| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->| Tests pass?   | yes| Fixed tickets | ?| License       | MIT| Doc PR        | noSee discussion#24517<!--- Bug fixes must be submitted against the lowest branch where they apply  (lowest branches are regularly merged to upper ones so they get the fixes too).- Features and deprecations must be submitted against the 3.4,  legacy code removals go to the master branch.- Please fill in this template according to the PR you're about to submit.- Replace this comment by a description of what your PR is solving.-->Commits-------345f2fc [DI] Fix possible incorrect php-code when dumped strings contains newlines
This was referencedNov 10, 2017
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

@xabbuhxabbuhxabbuh approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

6 participants

@Strate@nicolas-grekas@stof@xabbuh@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp