Skip to content

fix(core): import LanguageContextSelector in Nlsconfig - #235

Merged
ralflang merged 1 commit into
FRAMEWORK_6_0from
fix/nlsconfig-language-context-selector
Oct 2, 2026
Merged

ralflang merged 1 commit into
FRAMEWORK_6_0from
fix/nlsconfig-language-context-selector

Conversation

@TDannhauer

Copy link
Copy Markdown
Contributor

Summary

  • Import Horde\Core\LanguageContextSelector in Nlsconfig so the injector can create LanguageContext.
  • Read the Accept-Language header from the promoted constructor property.
  • Construct Nlsconfig in the unit test with the current argument order.

Motivation

Nlsconfig is in namespace Horde\Core\Registry and implements LanguageContextSelector without importing it. PHP therefore looked for Horde\Core\Registry\LanguageContextSelector, which does not exist. Date formatting requests LanguageContext, and the injector failed with Interface "Horde\Core\Registry\LanguageContextSelector" not found.

The same method used a bare $serverEnvironment, so the Accept-Language fallback never ran.

Changes

  • Add use Horde\Core\LanguageContextSelector in src/Registry/Nlsconfig.php.
  • Use $this->serverEnvironment in preferredLang().
  • Pass BackendConfigLoader, then the optional environment and session, in NlsconfigTest::makeNlsconfig().

Test plan

  • vendor/bin/phpunit --bootstrap vendor/autoload.php vendor/horde/core/test/Unit/Registry/NlsconfigTest.php (7 tests, 10 assertions)
  • Reload Horde and confirm the Cannot create Horde\Core\LanguageContext emergency log lines stop

Nlsconfig lives in Horde\Core\Registry and implemented LanguageContextSelector without importing it, so PHP looked up Horde\Core\Registry\LanguageContextSelector and the injector could not create LanguageContext. Read the Accept-Language header from the promoted constructor property, and construct Nlsconfig in the unit test with the current argument order.
@TDannhauer
TDannhauer requested a review from ralflang October 2, 2026 06:26
@ralflang
ralflang merged commit 2f3f7d2 into FRAMEWORK_6_0 Oct 2, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants