Skip to content
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

[Routing] Prevent localized routes _locale default & requirement from being overridden #35928

Merged

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Mar 2, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets #35915
License MIT
Doc PR -

When we have configured a localized route, its default _locale and _locale requirement should not be modified to ensure it works as expected.

@fancyweb fancyweb force-pushed the routing-prevent-_locale-override branch from e079d38 to 096dc0a Compare March 2, 2020 16:09
@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Mar 2, 2020
@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

@nicolas-grekas nicolas-grekas merged commit afdd507 into symfony:4.4 Mar 2, 2020
@@ -376,6 +376,10 @@ public function setDefaults(array $defaults)
*/
public function addDefaults(array $defaults)
{
if (isset($defaults['_locale']) && $this->isLocalized()) {
unset($defaults['_locale']);
Copy link
Contributor

Choose a reason for hiding this comment

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

What about throwing? (same in other places)

Copy link
Member

Choose a reason for hiding this comment

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

It would be a BC break, and more importantly it would forbid legit use cases where one imports several routes and some of them are localized.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand how this is breaking BC while we are already making it a noop here. Instead of legit use I see a silent failure, which could be reported at compile time for something wrongly configured.

Copy link
Member

Choose a reason for hiding this comment

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

There is no error on the userland side, reporting an exception would break legit use cases as I mentioned also. This is a bug, not a userland issue.

@fancyweb fancyweb deleted the routing-prevent-_locale-override branch March 2, 2020 18:38
This was referenced Mar 27, 2020
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.

None yet

5 participants