Review main Merged

76551[BUGFIX] CommandUtility::getCommand() results in error

Tomas Norre Mikkelsen CR +2 V +2 Easy +19 −7 updated 11/17/22, 18:50

Commit message

With PHP 8.1 the CommandUtility::getCommand() results in an
error:

Typed static property TYPO3\CMS\Core\Utility\CommandUtility::$paths
must not be accessed before initialization

This patch is to prevent this from happening

Review

  • Code review CR +2 Done
    • Anja Leichsenring +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Anja Leichsenring +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 3645

Show 1420 earlier messages
  1. Tomas Norre Mikkelsen uploaded patch set 1 11/11/22, 07:24

  2. Tomas Norre Mikkelsen commented on patch set 1 11/11/22, 07:25

    I am aware that this isn't solving anything yet. I just pushed the tests to prove the problem
  3. core-ci voted on patch set 1 V -1 11/11/22, 07:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33544

  4. Tomas Norre Mikkelsen uploaded patch set 2 11/11/22, 07:38

  5. Tomas Norre Mikkelsen commented on patch set 2 11/11/22, 07:39

    Reply

    I now have a suggestion for a fix.
  6. core-ci voted on patch set 2 V -1 11/11/22, 07:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33545

  7. Oliver Klee commented on patch set 2 11/11/22, 08:11

    CommandUtility.php:314

    The is_array check is then redundant. I personally would find it cleaner to make the property nullable (and initialize it with null), and then keep the is_array check.
  8. Oliver Klee commented on patch set 2 11/11/22, 08:11

    CommandUtilityTest.php:213

    The @return void is redundant (and our style check is unhappy with it).
  9. Tomas Norre Mikkelsen uploaded patch set 3 11/11/22, 08:14

  10. Tomas Norre Mikkelsen commented on patch set 3 11/11/22, 08:16

    CommandUtilityTest.php:213 Reply

    Done
  11. core-ci voted on patch set 3 V -1 11/11/22, 08:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33551

  12. Tomas Norre Mikkelsen uploaded patch set 4 11/11/22, 14:12

  13. Tomas Norre Mikkelsen uploaded patch set 5 11/11/22, 14:14

  14. Tomas Norre Mikkelsen commented on patch set 5 11/11/22, 14:15

    CommandUtility.php:314 Reply

    Done
  15. core-ci voted on patch set 4 V -1 11/11/22, 14:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33589

  16. core-ci voted on patch set 5 V +1 11/11/22, 14:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33590

  17. Oliver Klee voted on patch set 5 CR +1 11/11/22, 14:36

  18. Oliver Klee updated the commit message in patch set 6 11/11/22, 14:37

  19. Oliver Klee voted on patch set 6 CR +1 11/11/22, 14:37

  20. core-ci voted on patch set 6 V +1 11/11/22, 14:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33591

  1. Benni Mack voted on patch set 6 CR +1 11/11/22, 15:40

  2. Nikita Hovratov voted on patch set 6 V +1 CR +1 11/12/22, 18:50

  3. Oliver Klee commented on patch set 6 CR 0 11/12/22, 22:14

    CommandUtilityTest.php:217

    Wait, why are we using _call here?
  4. Nikita Hovratov uploaded patch set 7 11/13/22, 00:03

  5. Nikita Hovratov commented on patch set 6 V +1 CR +1 11/13/22, 00:04

    CommandUtilityTest.php:217 Reply

    Done
  6. core-ci voted on patch set 7 V +1 11/13/22, 00:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33657

  7. Stefan Bürk commented on patch set 7 CR -1 11/13/22, 00:28

    CommandUtilityTest.php:217

    Expecting this hardcoded value is tricky. Also this is a unit-test, a real lookup is done with the getCommand('php') call above. Using `Build/Scripts/runTests.sh` this is ensured "currently", as the binary resideds in that path in the used php images. Some people are executing tests directly, not using the runTests.sh - and may not have the "php" binary at this location. Not sure, but we should check here more for is_string(), not empty and/or $command contains/ends with 'php', so it is more flexible.
  8. Oliver Klee commented on patch set 7 11/13/22, 10:03

    CommandUtilityTest.php:217 Reply

    I think this should rather be a functional test (with the DB disabled) in order to communicate that we rely on the whole system working, and the assertion then should be more lenient: assertIsString and assertStringContainsString(‘php’, …) Then test name then could be something like this: getCommandWithPhpReturnsPathToPhpExecutable
  9. Tomas Norre Mikkelsen uploaded patch set 8 11/14/22, 06:45

  10. Tomas Norre Mikkelsen commented on patch set 8 11/14/22, 06:46

    CommandUtilityTest.php:217 Reply

    I have adjusted the patch set, based on your feedback. I don't see this as a functional test though, but if I'm only on this, we can of course change this.
  11. core-ci voted on patch set 8 V +1 11/14/22, 06:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33685

  12. Anja Leichsenring voted on patch set 8 V +1 CR +1 11/17/22, 18:24

  13. Christian Kuhn commented on patch set 8 V +1 CR +1 11/17/22, 18:25

    this patch is correct. the only issue is that we need to get rid of the static properties anyways, but that can happen in another patch for v12.
  14. Stefan Bürk voted on patch set 8 V +1 CR +1 11/17/22, 18:26

  15. Oliver Klee voted on patch set 8 V +1 CR +1 11/17/22, 18:29

  16. Christian Kuhn commented on patch set 8 11/17/22, 18:35

    imho, this is not an issue in v11 since the array type hint has been added in v12 only. will remove 11.5 from releases list now.
  17. Christian Kuhn updated the commit message in patch set 9 11/17/22, 18:35

  18. Christian Kuhn commented on patch set 10 11/17/22, 18:36

    Published edit on patch set 9.
  19. Oliver Klee voted on patch set 10 V +1 CR +1 11/17/22, 18:36

  20. Anja Leichsenring voted on patch set 10 V +1 CR +1 11/17/22, 18:37

  21. Stefan Bürk voted on patch set 10 V +1 CR +1 11/17/22, 18:40

  22. Christian Kuhn voted on patch set 10 V +1 CR +1 11/17/22, 18:40

  23. core-ci voted on patch set 10 V +1 11/17/22, 18:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33886

  24. Anja Leichsenring voted on patch set 10 V +2 CR +2 11/17/22, 18:50

  25. Anja Leichsenring merged patch set 11 11/17/22, 18:50