Skip to content

framework.enabled_locales does not behave as documented #47355

Closed
@lazka

Description

@lazka

Symfony version(s) affected

5.4.11

Description

https://symfony.com/doc/5.4/reference/configuration/framework.html#enabled-locales states that "empty array = enable all locales", but if I set an empty array then set_locale_from_accept_language will not set the locale. I have to fill enabled_locales for it to work.

Here is the code doing this:

} elseif ($this->useAcceptLanguageHeader && $this->enabledLocales && ($preferredLanguage = $request->getPreferredLanguage($this->enabledLocales))) {
which was added in #43108 ($this->enabledLocales is checked to be non-empty)

@chalasr is this logic on purpose? Or does the documentation need adjustment that empty means no locale is enabled?

How to reproduce

Run the following I guess:

public function testRequestNoLocaleFromAcceptLanguageHeader()

which tests that no locale is set if enabled_locales isn't set

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions