Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

[2.2] [HttpKernel] LocaleListener overrides request's locale #7474

Closed
uwej711 opened this Issue Mar 25, 2013 · 1 comment

Comments

Projects
None yet
3 participants
Contributor

uwej711 commented Mar 25, 2013

When using lunetics/LocaleBundle the request's locale can be set form different sources, not just the _locale parameter. But depending on the order of execution of the LocaleListener's, this is overridden by HttpKernel's LocaleListener. There are serveral fixes available for lunetics/LocaleBundle (see lunetics/LocaleBundle#62 or lunetics/LocaleBundle#59) but both actually depend on Symfony's implementation details.

Shouldn't the LocaleListener check the request's locale before setting/overriding it or should one of the solutions for lunetics/LocaleBundle be the solution?

Any help/comment welcome!

@fabpot fabpot added a commit that referenced this issue Apr 7, 2013

@fabpot fabpot merged branch uwej711/fix_locale_is_overridden (PR #7516)
This PR was merged into the 2.2 branch.

Discussion
----------

[HttpKernel] fix overwriting of request's locale by LocaleListener if attribute _locale is missing

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #7474
| License       | MIT
| Doc PR        | n.a.

Commits
-------

e8cae94 fix overwriting of request's locale if attribute _locale is missing
689653f

@fabpot fabpot closed this Apr 7, 2013

@fabpot could that bugfix also please cherrypicked to symfony 2.1? I would rather just keep at using $request->setLocale() in my LocaleBundles Eventlistener instead of manually using $request->attributes->set('_locale', $locale);

@lunetics lunetics referenced this issue in lunetics/LocaleBundle May 5, 2013

Closed

Add additional test coverage #67

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