Skip to content

[Routing] Fix URL generator instantiation #34192

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

Merged

Conversation

X-Coder264
Copy link
Contributor

@X-Coder264 X-Coder264 commented Oct 30, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
Deprecations? no
License MIT

After merging my fix (PR #31023) from the 4.2 branch to 4.3 (which was master at the time) one code path which instantiates the url generator was missed. This new code path was added via #28865 and was missed during the merge because there was no merge conflict there as that code path didn't exist on 4.2.

So the current state on the 4.3 branch is:

I noticed this in my app because tests started to fail on the branch where we are upgrading our app from SF 4.2 to 4.3 due to this. This PR fixes the inconsistency (now the default locale is passed on all three places) which fixes the bug.

@nicolas-grekas nicolas-grekas force-pushed the fix-url-generator-instantiation branch from 3035356 to 9aa66e2 Compare November 4, 2019 20:23
@nicolas-grekas
Copy link
Member

Good catch, thanks @X-Coder264.

nicolas-grekas added a commit that referenced this pull request Nov 4, 2019
…eMC)

This PR was merged into the 4.3 branch.

Discussion
----------

[Routing] Fix URL generator instantiation

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| License       | MIT

After merging my fix (PR #31023) from the 4.2 branch to 4.3 (which was master at the time) one code path which instantiates the url generator was missed. This new code path was added via #28865 and was missed during the merge because there was no merge conflict there as that code path didn't exist on 4.2.

So the current state on the 4.3 branch is:

- https://github.com/symfony/symfony/blob/v4.3.5/src/Symfony/Component/Routing/Router.php#L356 (default locale is properly passed to the constructor)

- https://github.com/symfony/symfony/blob/v4.3.5/src/Symfony/Component/Routing/Router.php#L372 (default locale is **NOT** properly passed to the constructor)

- https://github.com/symfony/symfony/blob/v4.3.5/src/Symfony/Component/Routing/Router.php#L378 (default locale is properly passed to the constructor)

I noticed this in my app because tests started to fail on the branch where we are upgrading our app from SF 4.2 to 4.3 due to this. This PR fixes the inconsistency (now the default locale is passed on all three places) which fixes the bug.

Commits
-------

9aa66e2 Add tests to ensure defaultLocale is properly passed to the URL generator
16c9baf Fix URL generator instantiation
@nicolas-grekas nicolas-grekas merged commit 9aa66e2 into symfony:4.3 Nov 4, 2019
@nicolas-grekas
Copy link
Member

Thank you @HypeMC too for the tests.

@X-Coder264 X-Coder264 deleted the fix-url-generator-instantiation branch November 10, 2019 22:36
@fabpot fabpot mentioned this pull request Nov 11, 2019
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.

5 participants