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] Use ID of the original service when key not specified in service_locator config#48653

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
upyx wants to merge1 commit intosymfony:6.3fromupyx:ids-in-service-locator

Conversation

@upyx
Copy link
Contributor

@upyxupyx commentedDec 14, 2022
edited
Loading

QA
Branch?7.0
Bug fix?no (but discussable#48454 (comment))
New feature?yes
Deprecations?yes (in#48686)
TicketsImplements#48454
LicenseMIT
Doc PRsymfony/symfony-docs#...

It fixes bug/implementes feature described in#48454

@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "6.3" but it seems your PR description refers to branch "5.4".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

useSymfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1;
useSymfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition2;

require_once__DIR__.'/../Fixtures/includes/autowiring_classes.php';
Copy link
Contributor

@BilgeBilgeDec 14, 2022
edited
Loading

Choose a reason for hiding this comment

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

Since I was also in the middle of trying to figure this out, I know why you did this, but probably most people reading this PR will not. I explained the issuehere and@chalasr has taken adifferent approach to avoid referencing the unloaded class.

However, I think we need to take further action with respect to this bug, because this is indicative that we have tests with hidden dependencies and this particular bug has existed for almost 1.5 years undetected. Relying on the happenstance deterministic (alphabetical) ordering of tests is bad because it means tests cannot be run in isolation, which makes development harder. The best way I know to remedy this is to applyexecutionOrder="random" to thephpunit.xml config, which should be done for all such files in this repository.

upyx reacted with thumbs up emoji
Copy link
Contributor

@BilgeBilge left a comment

Choose a reason for hiding this comment

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

We should document the new method.

returnnewReference($id);
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

In my view, this needs documentation to explain what it is doing and why. The method name certainly gives no indication as to what is going on here.

Suggested change
/**
/**
* Replaces numeric service IDs with service names.

The method name could probably be improved along these lines, also, e.g.replaceNumericServiceLocatorKeys.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks for the suggestion!

Comment on lines 108 to 115
}elseif (\is_int($k)) {
$i =null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this for?

chapterjason reacted with thumbs up emoji
$services[$k] =$v;
}

ksort($services);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

If I knew... I extracted this code for reusing. Theksort() was removed from theregister method onc67c2df. I have no idea why it still exists inprocessValue.

@Bilge
Copy link
Contributor

Bilge commentedDec 14, 2022
edited
Loading

By the way, there is no YAML fixture that actually tests the!service_locator tag works at all. We might consider adding a test case toYamlFileLoaderTest for this.

@chalasr
Copy link
Member

Please target 6.3. As discussed in#48454 this does not qualify as a bugfix but a feature as it is changing a behavior introduced 4 years ago that some people might rely on and some others probably worked around it by specifying keys explicitly.

By the way, there is no YAML fixture that actually tests the !service_locator tag works at all. We might consider adding a test case to YamlFileLoaderTest for this.

Agreed. PR welcome to add that missing test case (on the lowest maintained branch where it's applicable, probably 5.4).

@upyxupyxforce-pushed theids-in-service-locator branch fromafb0b40 to064bee1CompareDecember 14, 2022 20:40
@upyxupyx changed the base branch from5.4 to6.3December 14, 2022 20:41
@upyxupyx changed the titleFix IDs in ServiceLocatorUse ID of the original service when key not specified in service_locator configDec 14, 2022
@carsonbotcarsonbot changed the titleUse ID of the original service when key not specified in service_locator config[DependencyInjection] Use ID of the original service when key not specified in service_locator configDec 15, 2022
@chalasr
Copy link
Member

Closing as the 7.0 branch does not exist yet. See#48686

@Bilge
Copy link
Contributor

Dude... what. Even@nicolas-grekasOK'd the 6.x release implicitly in#48454 by stating it's a new feature, whichaccording to the docs, means the target branch is 6.x.

image

@chalasr
Copy link
Member

#48686 implements that feature on 6.x.

@upyx
Copy link
ContributorAuthor

@Bilge so do we not need to deprecate anything?

@chalasr if it so,it is the right PR, but not#48686

@upyx
Copy link
ContributorAuthor

upyx commentedDec 20, 2022
edited
Loading

@chalasr@nicolas-grekas
Please, could you get clear, should we deprecate the current undefined/unexpected/wrong documented but implemented behavior or not?

#48454 (comment)
#48454 (comment)

@wouterj
Copy link
Member

wouterj commentedDec 20, 2022
edited
Loading

This is a feature, but we have to take care of compatibility as to not break applications currently relying on the "odd behavior". Stability of behavior and code is the number 1 priority for anything in Symfony.

In this case, it is a bit tricky on how to change the behavior in a smooth way (we can't change behavior in 7.0 without a deprecation in 6.x, but we also can't have deprecations in 6.x that can't be fixed). Fortunately, 6.3 is nearly 6 months away still (and 7.0 almost a year from now), so we have all the time to figure out the best path forwards.

In any case,#48686 looks like a more promising PR than this one for 6.x (giving it doesn't change behavior). Let's continue finding the best solution in that PR.

nicolas-grekas added a commit that referenced this pull requestDec 22, 2022
…ce_locator" config (upyx)This PR was merged into the 6.3 branch.Discussion----------[DependencyInjection] Deprecate integer keys in "service_locator" config| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | no| New feature?  | no| Deprecations? | yes| Tickets       | Deprecation befor#48653| License       | MIT| Doc PR        |symfony/symfony-docs#17576It deprecates undefined/wrong behaviour ofhttps://symfony.com/doc/current/service_container/service_subscribers_locators.html#defining-a-service-locatorCommits-------57c2365 [DependencyInjection] Deprecate integers keys in "service_locator" config
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestFeb 21, 2023
…pyx)This PR was squashed before being merged into the 5.4 branch.Discussion----------[DependencyInjection] Remove not implemented behaviorCurrently numeric keys are used, but it will be deprecated and changed in 7.0.Deprecation:symfony/symfony#48686New behavior:symfony/symfony#48653Commits-------a8770de [DependencyInjection] Remove not implemented behavior
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@lyrixxlyrixxAwaiting requested review from lyrixx

@ycerutoycerutoAwaiting requested review from yceruto

@wouterjwouterjAwaiting requested review from wouterj

@chalasrchalasrAwaiting requested review from chalasr

@dunglasdunglasAwaiting requested review from dunglas

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@xabbuhxabbuhAwaiting requested review from xabbuh

1 more reviewer

@BilgeBilgeBilge requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

6.3

Development

Successfully merging this pull request may close these issues.

6 participants

@upyx@carsonbot@Bilge@chalasr@wouterj@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp