8000 [Routing] force stringable object to string in route parameter by garak · Pull Request #40342 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Routing] force stringable object to string in route parameter #40342

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from

Conversation

garak
Copy link
Contributor
@garak garak commented Mar 2, 2021
Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #26992
License MIT
Doc PR none

This is a simple proposal to fix related issue.

@Nyholm Nyholm added the Routing label Mar 2, 2021
@carsonbot carsonbot changed the title force stringable object to string in route parameter [Routing] force stringable object to string in route parameter Mar 2, 2021
Copy link
Member
@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Nice!

Sorry if Fabbot suggested a bunch of CS changes. :/

Copy link
Member
@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Thank you.
Im happy with this after two small changes.

garak and others added 2 commits March 2, 2021 14:49
Co-authored-by: Tobias Nyholm <tobias.nyholm@gmail.com>
Copy link
Member
@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Thank you.

Im happy with this.

Comment on lines +299 to +302
if (!\is_object($param)) {
continue;
}
if (!\is_callable([$param, '__toString'])) {
Copy link
Member

Choose a reason for hiding this comment

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

I think a future PR can deal with if you pass an array or callable.
Or we may think that is not needed.

@Nyholm
Copy link
Member
Nyholm commented Mar 2, 2021

Oh, Fabbot saw that you missed something when adding the sprintf. :)

@fabpot
Copy link
Member
fabpot commented Mar 4, 2021

I think I agree with @linaori's comments in the related issue, so mostly 👎
In any case, that would be for 5.x.

@fabpot
Copy link
Member
fabpot commented Mar 4, 2021

I forgot to mention that we tried to remove such string casts in the past from the framework. IIRC, @Tobion was quite vocal about this.

@Tobion
Copy link
Contributor
Tobion commented Mar 5, 2021

👎 #26992 (comment)

@fabpot
Copy link
Member
fabpot commented Mar 5, 2021

Closing as 2 core team members voted against this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0