Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas commentedOct 12, 2017
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 commentedOct 12, 2017
@nicolas-grekas done |
| $cleanParts =explode("\n",$value); | ||
| $cleanParts =array_map(function ($part) {returnvar_export($part,true); },$cleanParts); | ||
| returnimplode(' . "\n" .',$cleanParts); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 commentedOct 12, 2017
Some optimizations could be done, for example now string like |
nicolas-grekas commentedOct 12, 2017
PHP 7 will concat at compile time, so no need IMHO. |
stof commentedOct 12, 2017
So |
nicolas-grekas commentedOct 12, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
|
nicolas-grekas commentedOct 12, 2017
Thank you@Strate. |
…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
See discussion#24517