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

[DependencyInjection] fixed PhpDumper + as_files + new lines in string arguments/properties/etc of Definitions#24517

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?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#24470
LicenseMIT
Doc PRno

Handle the case, when exporting string contains new line, which cause
incorrect php code together withas_files option

fixes#24470

Handle the case, when exporting string contains new line, which causeincorrect php code together with `as_files` optionfixessymfony#24470
@nicolas-grekasnicolas-grekas added this to the3.4 milestoneOct 12, 2017
@nicolas-grekas
Copy link
Member

nicolas-grekas commentedOct 12, 2017
edited
Loading

If I remove your change in PhpDumper, I get this change in the fixtures file:

-return $this->services['foo'] = new \Foo('string with' . "\n" . 'new line');+return $this->services['foo'] = new \Foo('string with+');

The code without your change is thus perfectly fine.
This means the bug description (generating invalid PHP code?) is not proved yet.
We'd need a test case that actually generates invalid code, then a fix for it.
Possible? Otherwise, this means this fixes nothing in fact...

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedOct 12, 2017
edited
Loading

OH got it :) "new line" is missing when the patch is not applied!
This bug exists in 2.7 I think also, and not specific to as_files (see "explode" in "wrapServiceConditionals").

@nicolas-grekasnicolas-grekas modified the milestones:3.4,2.7Oct 12, 2017
@Strate
Copy link
ContributorAuthor

Strate commentedOct 12, 2017
edited
Loading

@nicolas-grekas yes. Generated code become invalid if test case changed from"string with\nnew line"
to"string with\nnl" - if length of after-\n part is less than 8, then generated code is invalid. I can add test case for that too.

UPD, just tested that, it compiles to:

return $this->services['foo2'] = new \Foo('string with

@nicolas-grekas
Copy link
Member

Can you submit the fix on 2.7?

@StrateStrate changed the base branch from3.4 to2.7October 12, 2017 11:10
@StrateStrate changed the base branch from2.7 to3.4October 12, 2017 11:10
@Strate
Copy link
ContributorAuthor

Strate commentedOct 12, 2017
edited
Loading

@nicolas-grekas I've made separate PR#24532
Unfortunatelly no tests, becasuse I don't know which case should be tested.

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
@fabpotfabpot closed thisOct 12, 2017
@fabpotfabpot reopened thisOct 12, 2017
@xabbuh
Copy link
Member

Isn't this fixed by#24532?

@Strate
Copy link
ContributorAuthor

@xabbuh this was created firstly, and this targets to 3.4

@xabbuh
Copy link
Member

Lower branches are merged up regularly. So the other fix will land in 3.4 eventually.

@Strate
Copy link
ContributorAuthor

But here is more unit test, target to as_files dumper option

@chalasr
Copy link
Member

chalasr commentedOct 17, 2017
edited
Loading

The test added on 2.7 seems good enough, the value ofas_files does not matter regarding the fixed bug in fact. This has been merged up to master by Nicolas already.
Closing this one.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

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@xabbuh@chalasr@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp