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

Insert correct parameter_bag service in AbstractController#27415

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

Merged
nicolas-grekas merged 1 commit intosymfony:4.1fromcurry684:fix-getparameter
May 30, 2018

Conversation

@curry684
Copy link
Contributor

@curry684curry684 commentedMay 29, 2018
edited
Loading

Reverts this feature being broken in3051289#diff-ef10778bc68793f8c8f4b71a7ba67790R86 -getParameter could never work now as it was querying the container itself instead of the parameter bag.

QA
Branch?4.1
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
LicenseMIT

Also see comments at#25439 (comment)

@fabpot
Copy link
Member

Can you add a test to make sure we won't have any regressions in the future?

@curry684
Copy link
ContributorAuthor

@fabpot added a pure regression guard on all subscribed services.

/**
* This test protects the default subscribed core services against accidental modification.
*
* @see https://github.com/symfony/symfony/pull/27415

Choose a reason for hiding this comment

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

please remove this link, we don't put github links in the source

*
* @see https://github.com/symfony/symfony/pull/27415
*/
publicfunctiontestSubscribedServices()

Choose a reason for hiding this comment

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

This doesn't really prevent anything, as it just duplicates the method.
I've no better idea, except maybe an integration test that would rely on autowiring+calling getParameter.
Worth it? As is right now, I'd prefer removing the current test case.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I kinda had the same issue - this fix has to go out today and I don't have time to write a really complex test for it.

I do not agree however it doesn't help at all and should be removed. Most specifically it would have prevented the mistake you made in the first place. The test itself may be dumb but it prevents BC breaks in removing or renaming core services that are depended upon, and changing their type. For example if someone changes theuse forContainerInterface in AbstractController to the PSR version this would catch it. I also specifically wrote it like this instead of an array compare to allowadding new subscriptions without failing. Unit tests are meant to prevent regressions and breaking existing code, without limiting new features. That's what it does. In a dumb way, but it works :P

Choose a reason for hiding this comment

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

it would have prevented the mistake you made

I'm not sure, because I would have changed the test accordingly, as that was not a typo buy my intention to target ContainerInterface. What I missed was that this broke autowiring...

Anyway, OK for keeping the test as is.

@nicolas-grekasnicolas-grekas added this to the4.1 milestoneMay 30, 2018
@curry684
Copy link
ContributorAuthor

Changed test as discussed with@nicolas-grekas on Slack.

@nicolas-grekasnicolas-grekas changed the base branch frommaster to4.1May 30, 2018 09:26
@nicolas-grekas
Copy link
Member

Thank you@curry684.

@nicolas-grekasnicolas-grekas merged commit37270d7 intosymfony:4.1May 30, 2018
nicolas-grekas added a commit that referenced this pull requestMay 30, 2018
… (curry684)This PR was submitted for the master branch but it was squashed and merged into the 4.1 branch instead (closes#27415).Discussion----------Insert correct parameter_bag service in AbstractControllerReverts this feature being broken in3051289#diff-ef10778bc68793f8c8f4b71a7ba67790R86 - `getParameter` could never work now as it was querying the container itself instead of the parameter bag.| Q             | A| ------------- | ---| Branch?       | 4.1| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| License       | MITAlso see comments at#25439 (comment)Commits-------37270d7 Insert correct parameter_bag service in AbstractController
@curry684curry684 deleted the fix-getparameter branchMay 30, 2018 09:32
@fabpotfabpot mentioned this pull requestMay 30, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

5 participants

@curry684@fabpot@nicolas-grekas@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp