Review main Merged

95153[BUGFIX] Correctly parse ORDER BY clauses with FIND_IN_SET

Christian Spoo CR +2 V +2 Normal +63 −3 updated 08/11/26, 00:05

Commit message

This patch add correct handling for complex ORDER BY clauses to
QueryHelper::parseOrderBy(), to ensure that only top-level delimiters
are taken into account when splitting the order columns.

The idea is to perform a depth search for delimiters inside parentheses
to skip splitting for these. As queries should not be parsed in loops
anyway, the performance implications should be negligible. FWIW, to
skip the new logic when it is not needed, the implementation first
checks whether there are any parentheses at all inside the ORDER BY
declaration in question.

Review

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

Issues 1

Files 2

Review log 810

  1. Christian Spoo uploaded patch set 1 08/06/26, 21:48

  2. core-ci voted on patch set 1 V -1 08/06/26, 21:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106072

  3. Christian Spoo uploaded patch set 2 V -1 08/06/26, 22:02

  4. core-ci voted on patch set 2 V +1 08/06/26, 22:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106078

  5. Markus Klein commented on patch set 2 CR +1 V +1 08/06/26, 22:27

    While I'm not a big fan of such PHP lexing code, I guess it is okay for this case. Sidenote: Maybe a clever regex could work as well?
  6. Oliver Klee voted on patch set 2 V +1 08/06/26, 22:40

  7. Christian Spoo commented on patch set 2 08/06/26, 22:55

    Reply

    I've thought of that as well. However, the regex I ended up with needed to be quite complex in order to correctly track balanced parentheses with the delimiter only being at the top level. Thus, I am unsure whether it would be wise to impact code legibility here. WDYT?
  8. Markus Klein commented on patch set 2 08/07/26, 11:31

    Reply

    Perfect. All good IMO.
  9. Stefan Bürk voted on patch set 2 CR +2 V +2 08/10/26, 23:54

  10. Stefan Bürk merged patch set 3 08/11/26, 00:05