Review main Work in progress Breaking

95269[!!!][TASK] Sort select options using Collator

Stefan Bürk CR 0 V 0 Normal +214 −31 updated 11/11/26, 14:34

Commit message

Follow up to the SORT_LOCALE_STRING replacement: since then the
select ViewHelpers sort option labels with SORT_STRING on PHP 8.6
and newer, and with SORT_LOCALE_STRING on older PHP versions. The
order therefore depends on the PHP version, on the process locale,
which is only set in frontend context, and on the locales installed
on the server. Byte wise comparison sorts upper case letters before
lower case ones and puts everything outside of ASCII behind "z".
That is not what sortByOptionLabel is supposed to achieve for
languages using umlauts or accented characters.

Both ViewHelpers now sort with \Collator, using the collation of the
current locale. ext-intl is a hard requirement of TYPO3 and core
already sorts that way in EXT:backend SelectItemProcessor and in
EXT:filelist FileList.

The locale is resolved from the site language in frontend context and
from the backend users language in backend context, following the
approach of the DateViewHelper. For the country select the argument
alternativeLanguage takes precedence, as it already selects the
language the labels are translated into.

\Collator::SORT_STRING is passed explicitly, so that labels keep being
compared as strings. The default \Collator::SORT_REGULAR would also
compare numeric labels as numbers, which would silently change the
order of such labels on top of the collation change.

This changes the rendered option order and is therefore a breaking
change, targeted at main only. It is deliberately not backported, so
that the order stays stable within TYPO3 v13 and v14.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 2
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/69/95269/2 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/69/95269/2 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Relation chain 2

  1. main 95270[WIP][TASK] Add PHP 8.6 to functional tests matrix Based on this change Work in progress Merge conflict Stefan Bürk CR 0 V 0 → 14.3, 13.4 Easy +15 −15
  2. 95269 [!!!][TASK] Sort select options using Collator This change

Merge conflicts 1

Issues 1

Files 5

Review log 24

  1. Stefan Bürk uploaded patch set 1 08/11/26, 18:35

  2. core-ci voted on patch set 1 V +1 08/11/26, 18:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106464

  3. Benni Mack uploaded patch set 2 V +1 11/11/26, 14:18

  4. core-ci voted on patch set 2 V +1 11/11/26, 14:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114095