Review main Merged

77898[BUGFIX] Fix PHP 8 warning in LinkValidatorController

Thomas Hohn CR +2 V +2 Easy +28 −6 updated 04/24/23, 16:08

Commit message

The variable $row['url_response']['errorParams'] should always contain
a value. Either the actual error message array or an empty array to
avoid a PHP 8 warning.
The corresponding getErrorMessage methods now have a guard clause to
check if the array is empty to avoid further propagated warnings.
In TYPO3 v13 that signature of the getErrorMessage should be changed to
be array.

The array $errorParams is always initialized to an empty array instead
of null. IN TYPO3 v13 the default value of $errorParams should be []
instead of null.

Review

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

Issues 1

Files 7

Review log 4457

Show 2432 earlier messages
  1. Thomas Hohn uploaded patch set 1 02/20/23, 09:50

  2. core-ci voted on patch set 1 V +1 02/20/23, 09:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37887

  3. Oliver Klee updated the commit message in patch set 2 V +1 02/20/23, 10:30

  4. Oliver Klee voted on patch set 2 CR +1 02/20/23, 10:30

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

  6. Guido Schmechel voted on patch set 2 CR +1 02/20/23, 13:31

  7. Sybille Peters commented on patch set 2 02/20/23, 16:40

    ExternalLinktype.php:249

    If the $errorParams is not an array or if $errorParams['errorType'] is not set, you continue here. Shouldn't you also return 'list.report.noinformation' in that case? (If that were already strictly typed, it might be different, but it is not). You could also do $errorType = $errorParams['errorType'] ?? ''; if ($errorType === '') { return ....
  8. Thomas Hohn uploaded patch set 3 CR +1 V +1 02/20/23, 17:21

  9. Thomas Hohn commented on patch set 2 02/20/23, 17:21

    ExternalLinktype.php:249 Reply

    Would make sense ;-)
  10. core-ci voted on patch set 3 V +1 02/20/23, 17:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37904

  11. Oliver Klee voted on patch set 3 CR +1 02/20/23, 17:32

  12. Sybille Peters commented on patch set 3 CR -1 02/26/23, 15:28

    ExternalLinktype.php:255

    You don't need to assign $errorType it twice.
  13. Sybille Peters rebased onto patch set 4 CR +1 V +1 02/26/23, 15:32

  14. Sybille Peters commented on patch set 4 02/26/23, 15:34

    ExternalLinktype.php:255 Reply

    Done
  15. core-ci voted on patch set 4 V +1 02/26/23, 15:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38120

  16. Sybille Peters commented on patch set 4 V +1 CR +1 02/26/23, 15:47

    I can't reproduce the exception (without the patch in latest main) but the change makes sense nonetheless
  17. JAKOTA Design Group GmbH commented on patch set 4 02/26/23, 19:15

    BrokenLinkRepository.php:318

    Wouldn't is be better to initialise $errorParams as [] instead of null and adding a null check later? And if $errorParams can be null shouldn't the type be ?array ?
  18. Sybille Peters commented on patch set 4 V 0 CR -1 02/26/23, 19:18

    BrokenLinkRepository.php:318 Reply

    I agree, it would be better to initialize as array. It is a bit of a mess currently. Please also look at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77777 where there are similar changes.
  19. Sybille Peters uploaded patch set 5 CR -1 V +1 02/26/23, 20:08

  20. Sybille Peters commented on patch set 5 02/26/23, 20:09

    BrokenLinkRepository.php:318 Reply

    Done
  21. core-ci voted on patch set 5 V -1 02/26/23, 20:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38132

  22. Thomas Hohn uploaded patch set 6 V -1 02/27/23, 05:12

  23. Thomas Hohn commented on patch set 6 02/27/23, 05:32

    BrokenLinkRepository.php:318 Reply

    But it's a breaking change to change the signature of the method (it's even a public method) - I believe you should add a comment that the method signature should change in v13?
  24. Thomas Hohn uploaded patch set 7 02/27/23, 05:40

  25. core-ci voted on patch set 6 V -1 02/27/23, 05:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38140

  26. core-ci voted on patch set 7 V +1 02/27/23, 05:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38141

  27. JAKOTA Design Group GmbH commented on patch set 7 02/27/23, 11:09

    LinkAnalyzer.php:228

    Is this a code style thing? Why not just add the null/false check in the function call? $this->brokenLinkRepository->addBrokenLink($record, false, $hookObj->getErrorParams() ?: []);
  28. Thomas Hohn commented on patch set 7 02/27/23, 11:23

    LinkAnalyzer.php:228 Reply

    You could ;-)
  29. Thomas Hohn uploaded patch set 8 V +1 02/27/23, 11:27

  30. Thomas Hohn commented on patch set 7 02/27/23, 11:27

    LinkAnalyzer.php:228 Reply

    Done
  31. Oliver Klee commented on patch set 8 02/27/23, 11:30

    BrokenLinkRepository.php:321

    The type here is missing: @param array $record
  32. core-ci voted on patch set 8 V +1 02/27/23, 11:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38150

  1. Thomas Hohn uploaded patch set 9 V +1 02/27/23, 11:46

  2. Thomas Hohn commented on patch set 8 02/27/23, 11:46

    BrokenLinkRepository.php:318 Reply

    Done

    BrokenLinkRepository.php:321 Reply

    Done
  3. core-ci voted on patch set 9 V +1 02/27/23, 11:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38152

  4. Thomas Hohn rebased onto patch set 10 V +1 03/06/23, 05:41

  5. core-ci voted on patch set 10 V +1 03/06/23, 05:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38512

  6. Benni Mack voted on patch set 10 CR +1 03/07/23, 08:06

  7. Jörg Bösche voted on patch set 10 CR +1 03/10/23, 07:41

  8. Oliver Klee voted on patch set 10 CR +1 03/10/23, 10:21

  9. Jochen Roth voted on patch set 10 V +1 CR +1 03/16/23, 15:36

  10. Guido Schmechel voted on patch set 10 CR +1 03/21/23, 08:27

  11. Thomas Hohn rebased onto patch set 11 CR +1 V +1 04/11/23, 18:45

    The following files contain Git conflicts: * typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php
  12. core-ci voted on patch set 11 V -1 04/11/23, 19:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40475

  13. Thomas Hohn uploaded patch set 12 V -1 04/19/23, 07:03

  14. Thomas Hohn marked it ready for review 04/19/23, 07:03

  15. core-ci voted on patch set 12 V +1 04/19/23, 07:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40892

  16. Oliver Klee voted on patch set 12 CR +1 04/19/23, 07:24

  17. Jörg Bösche voted on patch set 12 CR +1 04/19/23, 12:50

  18. Benni Mack voted on patch set 12 V +1 CR +1 04/20/23, 09:04

  19. Anja Leichsenring commented on patch set 12 V -1 04/20/23, 09:26

    on it
  20. Anja Leichsenring uploaded patch set 13 CR +1 V +1 04/20/23, 09:32

  21. Anja Leichsenring voted on patch set 13 V +1 CR +1 04/20/23, 09:33

  22. core-ci voted on patch set 13 V +1 04/20/23, 09:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40949

  23. Oliver Klee voted on patch set 13 CR +1 04/20/23, 10:01

  24. Stefan Bürk voted on patch set 13 V +2 CR +2 04/24/23, 16:08

  25. Stefan Bürk merged patch set 14 04/24/23, 16:08