Review main Merged

82142[BUGFIX] Prevent malformed SQL query in list module

Friedemann Altrock CR +2 V +2 Easy +4 −4 updated 03/06/24, 08:39

Commit message

A page outside of any site subtree has no available languages except the
default langauge (id 0). If a user is constrained to a non-default
language, opening the list module leads to an exception due to malformed
SQL query constraint.

Review

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

Issues 1

Files 1

Review log 1821

  1. Friedemann Altrock uploaded patch set 1 12/07/23, 12:28

  2. core-ci voted on patch set 1 V +1 12/07/23, 12:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50447

  3. Garvin Hicking commented on patch set 1 12/07/23, 12:44

    what would happen for admins without language restrictions, and if a page i.e. is temporarily moved outside a page tree and would be inspected?
  4. Stefan Bürk voted on patch set 1 CR -1 12/07/23, 12:53

  5. Friedemann Altrock commented on patch set 1 12/07/23, 13:20

    Reply

    An admin has all languages available, so they can always see language 0. In the NullSite though they only see the default language, and the List module shows no page translations even though there are some. This query restriction only applies to the "Page translation" box at the start of the list module, so if the admin goes to the parent page, they see all translations in the table view of the child pages. If a page is moved from a site-covered page tree to a tree outside of any page, the translations vanish, but again: only for the list view on that particular page.
  6. Friedemann Altrock commented on patch set 1 12/07/23, 13:21

    Reply

    (s/any page/any site/ in that last sentence.)
  7. Stefan Bürk commented on patch set 1 12/07/23, 13:29

    TBH - no qualified review yet, just a quick scrolling. See my comment for a suggestion to to it slightly in anotherway - not saying it's okay/or not or it should be dealt otherwise with.

    DatabaseRecordList.php:2375

    Instead of this if/else and non-sense dummy statement, we should do that in another way I guess: ``` $langConstraint = $queryBuilder->expr()->in( $GLOBALS['TCA']['pages']['ctrl']['languageField'], $queryBuilder->quoteArrayBasedValueListToIntegerList( array_keys($this->languagesAllowedForUser) ) ) ``` What do you think ?
  8. Christian Kuhn commented on patch set 1 CR -1 12/07/23, 13:37

    hey. let's see if we could at least get rid of the nonsense query somehow?
  9. Friedemann Altrock uploaded patch set 2 CR -1 V +1 12/07/23, 14:02

  10. Friedemann Altrock commented on patch set 2 12/07/23, 14:03

    Reply

    Yeah Stefan pointed me to quoteArrayBasedValueListToIntegerList, much better that way.

    DatabaseRecordList.php:2375 Reply

    Done
  11. core-ci voted on patch set 2 V +1 12/07/23, 14:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50454

  12. Jörg Bösche voted on patch set 2 CR +1 12/15/23, 10:19

  13. Benni Mack voted on patch set 2 CR +1 01/25/24, 13:26

  14. Friedemann Altrock rebased onto patch set 3 CR +1 V +1 01/26/24, 11:33

  15. core-ci voted on patch set 3 V +1 01/26/24, 11:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52236

  16. Stefan Bürk voted on patch set 3 CR +1 V +1 01/26/24, 12:16

  17. Guido Schmechel voted on patch set 3 CR +1 01/26/24, 12:25

  18. Oliver Klee voted on patch set 3 CR +1 01/26/24, 12:30

  19. Guido Schmechel commented on patch set 3 V +1 01/27/24, 14:09

    In the end, I only managed to fix this error by setting a test group, but the patch works wonderfully in this context :-)
  20. Stefan Bürk voted on patch set 3 CR +2 V +2 03/06/24, 08:25

  21. Stefan Bürk merged patch set 4 03/06/24, 08:39