Review main Merged

69507[TASK] Quote database identifiers when used instead of globally upfront

Helmut Hummel CR +2 V +2 Normal +108 −18 updated 08/04/21, 11:22

Commit message

The implementation of the bugfix https://review.typo3.org/53360
was done by iterating over TCA during cache generation and
correctly quoting SQL fragments that are provided, to after
that store TCA in cache.

This has disadvantages:

1. A DB connection is required to create TCA cache:
This makes efforts for warming up caches upfront impossible,
as cache warmup should be able to be performed on build
systems without DB connection.

2. It separates code that executes a query from code that
is preparing a query: Escaping arguments for a query in a
different place than the actual query execution can be
considered an anti pattern, because at other points it isn't
clear in which context these values are used. Beside that,
performing the actual query, undoing DB encoding and redoing
a different encoding is impossible.

Pre-processing / quoting identifiers upfront can be considered
a similar anti pattern as well. Despite there are less use
cases to perform operations on the original non quoted
identifiers, post processing of such fields in an event
is impossible with the current implementation.

3. The current implementation being buggy and the adoption
in TYPO3 is sparse: While this could be tackled with according
fixes, it shows that this feature, that has been implemented
a couple of years ago and is a technical burden, is rarely
used, and therefore the implementation can be simplified and
cleaned up.

The patch drops this TCA preparation and field name escaping
is now done in places where the queries are actually built.

Strictly seen this is a breaking change for implementers of
the TCA post processing event or for custom code that directly
uses TCA to perform query parts.

It is unlikely though that such code exists in userland,
nonetheless a feature flag "runtimeDbQuotingOfTcaConfiguration"
is introduced to allow extensions to also use the feature flag
and use the quoting on demand if not done before.

For TYPO3 v12, this feature flag will be enabled at all times.

Review

  • Code review CR +2 Done
    • Helmut Hummel +2
    • Christian Kuhn +1
    • Benni Mack +1
  • Verified V +2 Done
    • Helmut Hummel +2
    • Christian Kuhn +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 10

Review log 1421

  1. Helmut Hummel uploaded patch set 1 06/17/21, 10:03

  2. core-ci voted on patch set 1 V +1 06/17/21, 10:14 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12528

  3. Christian Kuhn commented on patch set 1 06/17/21, 10:45

    args. i was unaware that TCA compiling creates db connection. great to change this!
  4. Benni Mack uploaded patch set 2 08/02/21, 07:17

  5. core-ci voted on patch set 2 V -1 08/02/21, 07:39 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13974

  6. Benni Mack uploaded patch set 3 08/02/21, 17:46

  7. core-ci voted on patch set 3 V -1 08/02/21, 18:07 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14018

  8. Benni Mack uploaded patch set 4 08/03/21, 12:17

  9. core-ci voted on patch set 4 V +1 08/03/21, 12:35 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14044

  10. Benni Mack updated the commit message in patch set 5 08/03/21, 13:23

  11. core-ci voted on patch set 5 V +1 08/03/21, 13:37 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14048

  12. Benni Mack uploaded patch set 6 08/04/21, 09:48

  13. Benni Mack voted on patch set 6 V +1 CR +1 08/04/21, 09:48

  14. core-ci voted on patch set 6 V +1 08/04/21, 10:11 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14077

  15. Christian Kuhn uploaded patch set 7 08/04/21, 10:28

  16. Christian Kuhn commented on patch set 7 V +1 CR +1 08/04/21, 10:29

    tuned commit message and .rst file.
  17. Benni Mack voted on patch set 7 V +1 CR +1 08/04/21, 10:46

  18. core-ci voted on patch set 7 V +1 08/04/21, 10:49 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14082

  19. Helmut Hummel commented on patch set 7 V +2 CR +2 08/04/21, 11:18

    Thanks!
  20. Helmut Hummel merged patch set 8 08/04/21, 11:18

  21. Stephan Großberndt commented on patch set 8 08/04/21, 11:22

    Nice, thanks!