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

[HttpKernel] Handle previously convertedDateTime arguments#46199

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

@mbabker
Copy link
Contributor

QA
Branch?6.1
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix sensiolabs/SensioFrameworkExtraBundle#770
LicenseMIT
Doc PRN/A

I'm not sure I like this fix, but given the order of operations between the param converters in SensioFrameworkExtraBundle and the controller argument resolvers in the HttpKernel component, this is probably going to cause the least number of headaches for users when upgrading. And in some ways, this is the same problem as#40333 but in reverse.

Because the param converters are triggered on thekernel.controller event, they will handle converting values before the controller argument resolvers are fired. This means that a typehintedDateTimeInterface will potentially be handled twice (once by the param converter, once by the argument resolver). To avoid theTypeError noted in the issue, a practical fix is to gracefully handle a previously converted value in this resolver. As the other options aren't great (removing services from the container or turning off the param converters in full, which has other side effects), this is probably the most practical fix.

@chalasr
Copy link
Member

chalasr commentedApr 30, 2022
edited
Loading

or turning off the param converters in full, which has other side effects),

Can you elaborate on the side effects? I'm really not fond of patching Symfony to support a mix of param converters and argument value resolvers

@mbabkermbabkerforce-pushed thedatetime-param-converter-compat branch from5fb1e88 toa48ecb6CompareMay 1, 2022 00:03
@mbabker
Copy link
ContributorAuthor

or turning off the param converters in full, which has other side effects),

Can you elaborate on the side effects? I'm really not fond of patching Symfony to support a mix of param converters and argument value resolvers

If your app already relies on them, then turning off the param converters (especially with#43854 not making it into 6.1) ends up being a much bigger refactoring. As much as I don't like the patch either, being a pragmatist here, I do think it solves the upgrade issue in a way that causes the least frustration for end-users (as otherwise you really either have to turn off the param converters and rewrite all controllers relying on those or mess with the container to remove one of the services to avoid the double-conversion issue), and this one condition can be re-evaluated or removed once we're at a version where both of theSensioFrameworkExtraBundle converters have replacements.

@chalasr
Copy link
Member

especially with#43854 not making it into 6.1

I thought it was in, thanks.

@nicolas-grekas
Copy link
Member

Thank you@mbabker.

@nicolas-grekasnicolas-grekas merged commitc70be09 intosymfony:6.1May 1, 2022
@mbabkermbabker deleted the datetime-param-converter-compat branchMay 1, 2022 14:33
@fabpotfabpot mentioned this pull requestMay 14, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.1

Development

Successfully merging this pull request may close these issues.

Bug when convert datetime param on symfony 6.1

4 participants

@mbabker@chalasr@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp