#110967Stop changing the process locale per frontend request
Description
SiteResolver calls Locales::setSystemLocaleFromSiteLanguage() on every frontend request. That sets LC_COLLATE, LC_CTYPE, LC_MONETARY and LC_TIME from the locale of the site language.
setlocale() changes state for the whole process. The PHP manual warns that on multithreaded SAPIs the locale is shared by all threads. On thread-based runtimes such as FrankenPHP, a request can therefore change the locale under another request running at the same time. In worker mode, the locale would also carry over to later requests.
Core only reads this locale in three places:
- DateFormatter::strftime() falls back to setlocale(LC_TIME, ‘0’) when it gets no locale. In practice this affects TypoScript stdWrap.strftime.
- GeneralUtility::formatSize() reads decimal and thousands separators via localeconv(). It temporarily changes LC_NUMERIC to do so.
- SelectViewHelper and CountrySelectViewHelper sort options with SORT_LOCALE_STRING.
Since PHP 8.2, case conversion (strtolower(), ucfirst(), …) no longer depends on the locale.
Reviews 1
History 03
-
Gerrit Code Review pushed patch set 1 for main to change 96567 status
NewUnder Review <span data-processor="relativetime" data-value="2026-10-09T16:51:29+00:00" > 10/09/26, 16:51 </span> -
Gerrit Code Review pushed patch set 2 for main to change 96567 <span data-processor="relativetime" data-value="2026-11-09T13:26:17+00:00" > 11/09/26, 13:26 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 96567 <span data-processor="relativetime" data-value="2026-11-10T17:12:51+00:00" > 11/10/26, 17:12 </span>