Review main Merged

86702[BUGFIX] Handle invalid pageTitleProviders definitions

Lina Wolf CR +2 V +2 Easy +1 −1 updated 11/08/24, 13:37

Commit message

If the provider for a page title is not a valid class for some reason
the core code must silently skip that.

The call to class_exists() is removed in favor of the existing
call to is_subclass_of().
is_subclass_of() can take a string as input but also NULL (mixed) and will not fail, unlike class_exists(). And it will return false when
being passed a NULL input.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Garvin Hicking +1
    • Markus Klein +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Garvin Hicking +1
    • Markus Klein +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 2025

  1. Lina Wolf uploaded patch set 1 10/23/24, 07:23

  2. core-ci voted on patch set 1 V -1 10/23/24, 07:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68428

  3. Lina Wolf uploaded patch set 2 V -1 10/23/24, 07:32

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

  5. Oli Bartsch commented on patch set 2 10/24/24, 06:34

    PageTitleProviderManager.php:57

    Could we get rid of the `class_exists()` call at all since this is implicit checked by `is_subclass_of()` ?
  6. Lina Wolf commented on patch set 2 10/24/24, 06:37

    PageTitleProviderManager.php:57 Reply

    We probably could but that is not part of this change. It has been there before
  7. Lina Wolf commented on patch set 2 10/24/24, 06:37

    PageTitleProviderManager.php:57 Reply

    Acknowledged
  8. Garvin Hicking commented on patch set 2 11/08/24, 09:10

    PageTitleProviderManager.php:57 Reply

    I also think that this would be the more legible solution: ``` if (is_subclass_of($configuration['provider'], PageTitleProviderInterface::class)) { ``` is_subclass_of() can take a string as input but also NULL (mixed) and will not fail, unlike class_exists(). And it will return false when passing a NULL input.
  9. Markus Klein commented on patch set 2 11/08/24, 09:35

    PageTitleProviderManager.php:57 Reply

    I'd skip the class_exists too. is_subclass_of does autoloading and basically includes the class_exists check
  10. Oli Bartsch commented on patch set 2 11/08/24, 09:46

    PageTitleProviderManager.php:57 Reply

    Just make sure to use `is_subclass_of($configuration['provider'] ?? null, PageTitleProviderInterface::class)` to prevent undefined array key warnings.
  11. Lina Wolf uploaded patch set 3 V +1 11/08/24, 10:48

  12. Lina Wolf commented on patch set 3 11/08/24, 10:53

    PageTitleProviderManager.php:57 Reply

    Done
  13. core-ci voted on patch set 3 V +1 11/08/24, 10:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69227

  14. Garvin Hicking commented on patch set 3 CR +1 V +1 11/08/24, 11:02

    Looks good to me and seems to work; sadly not covered by tests, and adding tests to the manager doesn't look too straight forward that would rectify the effort for this specific patch.
  15. Oli Bartsch commented on patch set 3 11/08/24, 11:11

    Shouldn't we backport this to v12 as well?
  16. Garvin Hicking commented on patch set 3 11/08/24, 11:18

    Reply

    I'm often not sure what classifies as 'priority bugfix'. I think having this in v12 would be an improvement, yes.
  17. Markus Klein commented on patch set 3 11/08/24, 12:48

    Reply

    My approach: If it was important enough to be reported for v12, I target v12. It also shows appreciation to the reporter. Benni can still deny it.
  18. Markus Klein updated the commit message in patch set 4 CR +1 V +1 11/08/24, 12:48

  19. Markus Klein updated the commit message in patch set 5 11/08/24, 12:51

  20. Markus Klein voted on patch set 5 CR +1 V +1 11/08/24, 12:51

  21. core-ci voted on patch set 4 V +1 11/08/24, 12:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69230

  22. core-ci voted on patch set 5 V +1 11/08/24, 12:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69231

  23. Garvin Hicking voted on patch set 5 CR +1 V +1 11/08/24, 13:36

  24. Oli Bartsch voted on patch set 5 CR +2 V +2 11/08/24, 13:37

  25. Oli Bartsch merged patch set 6 11/08/24, 13:37