Review main Merged

93146[BUGFIX] Properly evaluate '--create-site' in CLI SetupCommand

Garvin Hicking CR +2 V +2 Easy +13 −7 updated 03/30/26, 10:59

Commit message

Supplying the option `--create-site` to this command:

```
vendor/bin/typo3 setup --server-type=other --driver=mysqli \
  --host=db --port=3306 --dbname=db --username=db --password=db \
  --create-site
```

possibly returned `false` previously as the defined input option
default value, but now may return `null`, which is not part of
the method's `getFallbackValueEnvOrOption` return value and will
throw a PHP TypeError.

The important thing is: The command attribute itself requires
a value, so it made no sense to just add it as an argument
without a value.

This patch now:

* requires a value for the `--create-site` option

* modifies the question helper callback used in `getSiteSetup()` for
  interactive mode and non-interactive mode to take an empty
  string as invalid value and throw an exception

* hardens the `getFallbackValueEnvOrOption()` method by making
  the code path more clear and ensure to now return
  only a string or false to respect the defined method return
  type declaration. The method comment is adjusted to reflect this.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1722

  1. Garvin Hicking uploaded patch set 1 03/10/26, 15:14

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

  3. Georg Ringer voted on patch set 1 CR +1 V +1 03/20/26, 06:33

  4. Stefan Bürk commented on patch set 1 03/20/26, 07:00

    Based on quick look the solution does not feel right. Not having right now the time to have a detailed look and **after** aligning shortly with Garvin I put a temp -1 on it and have a detailed review on the weekend and trying to find a better solution. But I may be wrong. Note: The issue is in there quite long now - stumpled across that already long time ago but forgot about it.
  5. Stefan Bürk voted on patch set 1 CR -1 03/20/26, 07:00

  6. Stefan Bürk uploaded patch set 2 CR +1 V +1 03/30/26, 09:36

  7. Stefan Bürk commented on patch set 1 CR -1 03/30/26, 09:36

    Reply

    Sorry for the delay in review. I had now a change to look into it. IMO I would say that the solution for the `--create-site` should be making the value required and not optional. Handing over a empty string does not create a site anyway and makes no sense. That would be the minimal change to mitigate the issue in my eyes. However, I have the gut feeling that we should harden the `getFallbackValueEnvOrOption` method that it ensured returns either a string or falls in general to avoid TypeErrors in the future - but in a more visible way.
  8. Stefan Bürk commented on patch set 2 03/30/26, 09:37

    Reply

    Done
  9. Stefan Bürk updated the commit message in patch set 3 03/30/26, 09:39

  10. Stefan Bürk voted on patch set 3 CR +1 V +1 03/30/26, 09:48

  11. core-ci voted on patch set 2 V -1 03/30/26, 09:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99024

  12. Stefan Bürk voted on patch set 3 V 0 CR -1 03/30/26, 09:50

  13. core-ci voted on patch set 3 V -1 03/30/26, 09:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99025

  14. Stefan Bürk uploaded patch set 4 CR -1 V -1 03/30/26, 09:52

  15. core-ci voted on patch set 4 V +1 03/30/26, 10:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99026

  16. Stefan Bürk voted on patch set 4 CR +1 V +1 03/30/26, 10:06

  17. Garvin Hicking updated the commit message in patch set 5 CR +1 V +1 03/30/26, 10:26

  18. core-ci voted on patch set 5 V +1 03/30/26, 10:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99036

  19. Stefan Bürk voted on patch set 5 CR +1 V +1 03/30/26, 10:40

  20. Georg Ringer voted on patch set 5 CR +1 V +1 03/30/26, 10:41

  21. Garvin Hicking voted on patch set 5 CR +2 V +2 03/30/26, 10:46

  22. Garvin Hicking merged patch set 6 03/30/26, 10:59