Review main Merged

97053[BUGFIX] Use language 0 as default language of a site

Benni Mack CR +2 V +2 Normal +66 −2 updated 10/30/26, 07:07

Commit message

Site::getDefaultLanguage() returned the first configured language.
If languageId 0 was not the first entry in the site configuration,
another language was treated as default language, e.g. in the page
module or for preview links.

Language 0 is now returned regardless of its position. For such sites
this also affects the frontend: the redirect of the site root, links
generated without a language and "?id=" requests on a site without
a root language base now use language 0 instead of the first entry.

Sites without language 0 keep receiving the first configured
language, so their frontend continues to work.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • André Buchmann +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • André Buchmann +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 2228

Show 23 earlier messages
  1. Benni Mack uploaded patch set 1 10/23/26, 07:40

  2. core-ci voted on patch set 1 V +1 10/23/26, 07:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112235

  3. Georg Ringer voted on patch set 1 CR +1 V +1 10/23/26, 07:58

  1. André Buchmann commented on patch set 1 10/23/26, 09:02

    Site.php:286

    As of today TYPO3 can't handle sites without 0. Therefore I think we should rather trow here if 0 is missing completely.
  2. André Buchmann rebased onto patch set 2 CR +1 V +1 10/23/26, 12:49

  3. André Buchmann uploaded patch set 3 10/23/26, 13:01

  4. André Buchmann commented on patch set 3 10/23/26, 13:02

    Site.php:286 Reply

    Done
  5. core-ci voted on patch set 2 V +1 10/23/26, 13:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112302

  6. core-ci voted on patch set 3 V -1 10/23/26, 13:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112303

  7. André Buchmann uploaded patch set 4 V -1 10/23/26, 14:28

  8. core-ci voted on patch set 4 V +1 10/23/26, 14:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112321

  9. Benni Mack voted on patch set 4 CR +1 V +1 10/23/26, 15:25

  10. Eric Harrer voted on patch set 4 CR +1 V +1 10/27/26, 09:43

  11. Josua Vogel voted on patch set 4 CR +1 V +1 10/28/26, 08:56

  12. Benni Mack updated the commit message in patch set 5 CR +1 V +1 10/28/26, 09:37

  13. core-ci voted on patch set 5 V +1 10/28/26, 09:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112693

  14. Josua Vogel voted on patch set 5 CR +1 V +1 10/28/26, 09:56

  15. Oli Bartsch commented on patch set 5 10/28/26, 10:19

    Can we drop the exception and fall back to the first configured language instead? `return $this->languages[0] ?? reset($this->languages);`
  16. Benni Mack commented on patch set 5 10/28/26, 10:22

    Reply

    that was the original approach, then people don't know that TYPO3 does not support site configs without language=0 yet (e.g. page module will fail etc)
  17. Oli Bartsch commented on patch set 5 10/28/26, 10:29

    Reply

    Agree that we should make this visible. But currently such a site still renders in the frontend. The backend shows wrong columns, but I could not find a place that actually fails without language 0. With the exception, every frontend request of such a site breaks after an update. Can we split this? Use the fallback here as a plain bugfix, which we can backport to 14.3 and enforce language 0 in a follow-up on main only? Ideally that follow-up validates the site configuration when it is loaded or in the Sites module, so integrators get a clear message instead of an exception.
  18. Benni Mack commented on patch set 5 10/28/26, 15:57

    Reply

    fine by me.
  19. Oli Bartsch uploaded patch set 6 CR +1 V +1 10/29/26, 22:06

  20. Oli Bartsch commented on patch set 6 CR +1 V +1 10/29/26, 22:08

    Reply

    Done
  21. core-ci voted on patch set 6 V +1 10/29/26, 22:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112812

  22. Oli Bartsch commented on patch set 6 10/29/26, 22:38

    Reply

    Follow-ups: * tiles crash in the Sites overview for sites without language 0 https://review.typo3.org/c/Packages/TYPO3.CMS/+/97221 * enforcing language 0 in the Sites module https://review.typo3.org/c/Packages/TYPO3.CMS/+/97222
  23. André Buchmann voted on patch set 6 CR +1 V +1 10/30/26, 06:10

  24. Benni Mack voted on patch set 6 CR +2 V +2 10/30/26, 07:07

  25. Benni Mack merged patch set 7 10/30/26, 07:07