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] Fix autocastingnull env values to empty string withcontainer.env_var_processors_locator#51198

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

Conversation

@fancyweb
Copy link
Contributor

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
Tickets#50837 (comment)
LicenseMIT
Doc PRno

The previous fix doesn't work when$processors comes fromcontainer.env_var_processors_locator.

$prefix ='';
}
$processor =$processors->has($prefix) ?$processors->get($prefix) :newEnvVarProcessor($this);
if (false ===$i && EnvVarProcessor::class ===\get_class($processor)) {
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

or instanceof I don't know?

Choose a reason for hiding this comment

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

Why is this extra condition needed at all? I removed it and tests still pass.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Because we implemented the empty string behavior only in our EnvVarProcessor class.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Looking at this again, I think it's safer to add the condition 🤔

Choose a reason for hiding this comment

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

I'm not fan of hardcoding a behavior for EnvVarProcessor only. Can't we add some phpdoc in the interface to explain how a processor should behave instead?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

We could, but my point is that we added this special behavior on 5.4 as a bug fix 😅 Isn't it too late to change the behavior for every consumer?

Choose a reason for hiding this comment

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

I think it's too much an edge case, nobody replaced the "string" processor :)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I added a comment but I'm not convinced it's needed/understandable. I let you takeover 😄

@fancyweb
Copy link
ContributorAuthor

Ping@bendavies can you try this patch plz?

@OskarStarkOskarStark changed the title[DependencyInjection] Fix autocasting null env values to empty string with container.env_var_processors_locator[DependencyInjection] Fix autocastingnull env values to empty string withcontainer.env_var_processors_locatorAug 2, 2023
@fancywebfancywebforce-pushed thedi/fix-null-autocast-again branch 3 times, most recently fromdb34fb0 toa5abf0dCompareAugust 4, 2023 15:30
@nicolas-grekasnicolas-grekasforce-pushed thedi/fix-null-autocast-again branch 2 times, most recently from0773b18 to38bc998CompareAugust 14, 2023 13:42
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

Friendly ping@bendavies can you please try this patch and report back?

$prefix ='';
}
$processor =$processors->has($prefix) ?$processors->get($prefix) :newEnvVarProcessor($this);
if (false ===$i && EnvVarProcessor::class ===\get_class($processor)) {

Choose a reason for hiding this comment

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

Why is this extra condition needed at all? I removed it and tests still pass.

@bendavies
Copy link
Contributor

Friendly ping@bendavies can you please try this patch and report back?

@nicolas-grekas i'm afraid i'm afk on holiday for 3 weeks. i can check when i'm back if you can wait.

@bendavies
Copy link
Contributor

yes, this seems to resolve the issue.

@fancywebfancywebforce-pushed thedi/fix-null-autocast-again branch from38bc998 to5f0a0e2CompareSeptember 19, 2023 16:19
@fancywebfancywebforce-pushed thedi/fix-null-autocast-again branch from5f0a0e2 to766bc6eCompareSeptember 20, 2023 06:24
@nicolas-grekas
Copy link
Member

Thank you@fancyweb.

@nicolas-grekasnicolas-grekas merged commitb9c30fb intosymfony:5.4Sep 20, 2023
@fancywebfancyweb deleted the di/fix-null-autocast-again branchSeptember 20, 2023 11:47
This was referencedSep 30, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

4 participants

@fancyweb@bendavies@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp