Issue Task Under Review

#111408Sort select ViewHelper options using Collator

Benni Mack 11/11/26, 14:15 updated 11/11/26, 14:18

Description

Follow-up to #111310.

The ViewHelpers <f:form> and <f:form> sort their options by label when sortByOptionLabel=“true” is set. Since #111310 they use SORT_STRING on PHP 8.6 and newer (SORT_LOCALE_STRING is deprecated there) and SORT_LOCALE_STRING on older PHP versions.</f:form></f:form>

The resulting order therefore depends on
  • the PHP version,
  • the process locale (LC_COLLATE), which TYPO3 only sets in frontend context, so the backend effectively sorts byte wise,
  • whether the locale of the site language is installed on the server.

Byte wise comparison sorts all upper case letters before lower case ones and puts every non-ASCII character behind “z” (e.g. “Banana” before “apple”, “Äpfel” after “Zebra”).

Both ViewHelpers should sort with \Collator instead, using the collation of the current locale: the site language in frontend context, the backend user’s language in backend context, and the argument alternativeLanguage for <f:form>. Labels keep being compared as strings (\Collator::SORT_STRING), so “10” still sorts before “9”. ext-intl is already required, and core sorts this way in SelectItemProcessor and FileList.</f:form>

This changes the rendered option order in some setups, so it is a breaking change for main only.

Reviews 1

History 01