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] Process PHP configs using the ContainerConfigurator#54970

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:7.1fromMatTheCat:ticket_54852
May 17, 2024

Conversation

@MatTheCat
Copy link
Contributor

@MatTheCatMatTheCat commentedMay 17, 2024
edited
Loading

QA
Branch?7.1
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#54852
LicenseMIT

Since#52843,ContainerConfigurator::extension is not called anymore which meansParamConfigurators are no longer processed and converted to strings, and makes nodes validation fail: e.g.framework.secret would receive anEnvConfigurator and throw because it is not a scalar.

@nicolas-grekas
Copy link
Member

Thank you@MatTheCat.

@nicolas-grekasnicolas-grekas merged commit4e01371 intosymfony:7.1May 17, 2024
@MatTheCat
Copy link
ContributorAuthor

…that was fast!

@yceruto does this PR seem okay to you?

@MatTheCatMatTheCat deleted the ticket_54852 branchMay 17, 2024 14:29
{
foreach ($configBuildersas$configBuilder) {
$this->loadExtensionConfig($configBuilder->getExtensionAlias(),$configBuilder->toArray());
$containerConfigurator->extension($configBuilder->getExtensionAlias(),$configBuilder->toArray(),$this->prepend);
Copy link
Member

Choose a reason for hiding this comment

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

I still need to do some config prepending tests, but I feel that we've missed something here as the previous$this->loadExtensionConfig() is currently doing more things when prepend argument istrue, e.g. the nested importing might be broken...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I saw you made theContainerConfigurator able to prepend in#52636 so I assumed it was okay but it is indeed missing this part:

if ($this->importing) {
if (!isset($this->extensionConfigs[$namespace])) {
$this->extensionConfigs[$namespace] = [];
}
array_unshift($this->extensionConfigs[$namespace],$config);
return;
}

Don’t know if it is an issue at all though 😓

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it'll be an issue when want to prepend nested configs using imports

Copy link
Member

Choose a reason for hiding this comment

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

After some quick tests, the root issue should be mitigated by processing only the config value this way:

$this->loadExtensionConfig($configBuilder->getExtensionAlias(), ContainerConfigurator::processValue($configBuilder->toArray()));

that will keep the prepending strategy working again. Would you mind creating another PR to update it? I can do it otherwise

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

If you already have the tests I think you’re more reading than I am; go ahead 😁

WouldContainerConfiguration::extension serve a purpose then?

yceruto reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

MatTheCat reacted with rocket emoji
Copy link
Member

Choose a reason for hiding this comment

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

Would ContainerConfiguration::extension serve a purpose then?

It should be avoided internally where recursive importing is involved, as now importing fromprependExtension() is supported (which requires an specific holding strategy to keep the importing order). However, you can still use it on your end for trivial array config importing (either in theprependExtension() orloadExtension() methods).

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Okaaay thanks; glad I asked your review 😄

yceruto reacted with heart emoji
@yceruto
Copy link
Member

yceruto commentedMay 17, 2024
edited
Loading

@MatTheCat thanks for the ping, I'm checking deeper... but AFAIR we don't resolve env var during prepending phase before, it's done during the merging process (aka loadExtension) when all configs were merged.

@MatTheCat
Copy link
ContributorAuthor

@yceruto thanks for looking!

Not sure what you call “resolving” env vars but this PR essentially stringifyParamConfigurators, which happens before replacing said parameters with their actual value.

@yceruto
Copy link
Member

but AFAIR we don't resolve env var during prepending phase before, it's done during the merging process (aka loadExtension) when all configs were merged.

Nevemind, I got it, it's about processing the configurator as beforehttps://github.com/symfony/symfony/pull/52843/files#diff-1cd56b329433fc34d950d6eeab9600752aa84a76cbe0693d3fab57fed0f547d3L150

MatTheCat reacted with thumbs up emoji

@fabpotfabpot mentioned this pull requestMay 17, 2024
fabpot added a commit that referenced this pull requestMay 21, 2024
…ig loader (yceruto)This PR was merged into the 7.1 branch.Discussion----------[DependencyInjection] Fix prepending strategy for php config loader| Q             | A| ------------- | ---| Branch?       | 7.1| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        |Fix#54852| License       | MITworking towards fixing#54970Commits-------a7ecb85 Fix prepending strategy for php config loader
symfony-splitter pushed a commit to symfony/dependency-injection that referenced this pull requestMay 21, 2024
…ig loader (yceruto)This PR was merged into the 7.1 branch.Discussion----------[DependencyInjection] Fix prepending strategy for php config loader| Q             | A| ------------- | ---| Branch?       | 7.1| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        | Fix #54852| License       | MITworking towards fixingsymfony/symfony#54970Commits-------a7ecb8568d Fix prepending strategy for php config loader
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ycerutoycerutoyceruto left review comments

Assignees

No one assigned

Projects

None yet

Milestone

7.1

Development

Successfully merging this pull request may close these issues.

[Config] ParamConfigurator is not longer respected as scalar-string-value

4 participants

@MatTheCat@nicolas-grekas@yceruto@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp