• Helmut Hummel's avatar
    [TASK] Quote database identifiers when used instead of globally upfront · 55b8185f
    Helmut Hummel authored
    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.
    Releases: master
    Resolves: #94697
    Change-Id: Ie0e48054def29c6c1e2810c8d30528c719439d9f
    Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69507
    Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
    Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
    Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
    Tested-by: Helmut Hummel's avatarHelmut Hummel <typo3@helhum.io>
    Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
    Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
    Reviewed-by: Helmut Hummel's avatarHelmut Hummel <typo3@helhum.io>