Review main Merged

95671[BUGFIX] Ensure numeric site identifiers stay strings

Oli Bartsch CR +2 V +2 Easy +34 −0 updated 09/07/26, 19:08

Commit message

A site directory consisting of digits only, e.g.
config/sites/123, made every request fail with a
TypeError, because Site::__construct() expects
a string identifier.

SiteConfiguration::getAllResolvedSiteData() does
cast the identifier to string, but uses it as an
array key afterwards, where PHP converts a numeric
string back to int. The cast is therefore repeated
in resolveAllExistingSites(), directly where the
Site object is created.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • Benni Mack +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 910

  1. Oli Bartsch uploaded patch set 1 09/07/26, 07:44

  2. core-ci voted on patch set 1 V +1 09/07/26, 07:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107980

  3. Stefan Bürk voted on patch set 1 CR +1 V +1 09/07/26, 09:00

  4. Oliver Klee commented on patch set 1 V +1 09/07/26, 09:27

    SiteConfiguration.php:118

    Overwriting the key in a loop feels a bit dirty to me. We could move the cast directly to where the variable is used (a few lines down). WDYT?
  5. Oli Bartsch commented on patch set 1 09/07/26, 09:52

    SiteConfiguration.php:118 Reply

    I don't see why this should be "dirty". It's IMO totally correct this way to ensure possible further usages are safe, too.
  6. Stefan Bürk commented on patch set 1 09/07/26, 09:59

    SiteConfiguration.php:118 Reply

    It's directly used in the next statement (ignoring code comments) within the loop, so it's exactly at the right place. (It's used 2 times in the loop but the first one already requires it as a string). Beside that, it's the same way how it is done in getAllResolvedSiteData() for example.
  7. Benni Mack voted on patch set 1 CR +1 V +1 09/07/26, 10:38

  8. Oliver Klee voted on patch set 1 CR +1 09/07/26, 10:50

  9. Georg Ringer voted on patch set 1 CR +2 V +2 09/07/26, 18:23

  10. Georg Ringer merged patch set 2 09/07/26, 19:08