Issue Bug Closed

#100807Analyze Database Structure fails with EnforceableQueryRestriction and constructor dependencies

Nicole Hummel 05/04/23, 10:34 updated 04/21/26, 11:30

Description

Given:

- an own class implementing the QueryRestrictionInterface and EnforceableQueryRestrictionInterface using a constructor dependency to another class
- this class is marked as public in settings.yaml
- this class is registered in $GLOBALS[‘TYPO3_CONF_VARS’][‘DB’][‘additionalQueryRestrictions’]

Expectation:

- calling “Analyze Database Structure” in maintenance module should compare the current database structure with expected on

Actual:

- an error occurs as the (constructor) dependency cannot be resolved
- the failsafe container instead of the symfony dependency container is used

Reviews 2

History 1020

  1. Garvin Hicking commented and changed category <span data-processor="relativetime" data-value="2024-07-31T11:15:35+00:00" > 07/31/24, 11:15 </span>

    Probably the fail-safe container can’t be circumvented easily, because all the maintenance section runs with it.
    Adjusting category of this issue.

  2. Stefan Bürk commented <span data-processor="relativetime" data-value="2024-11-07T16:01:55+00:00" > 11/07/24, 16:01 </span>

    Would be nice to know which query / code executes a query using the restricting in that context. I’d say, all queries within db analyzer should omit any restrictin completly in that context.

  3. Christian Kuhn commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2025-02-03T06:51:55+00:00" > 02/03/25, 06:51 </span>

    Agreed, Stefan. Nicole, would you like to backtrace to see which ext:install related query triggers this?

  4. Stefan Bürk commented and changed assigned to Stefan Bürk <span data-processor="relativetime" data-value="2026-04-14T09:23:59+00:00" > 04/14/26, 09:23 </span>

    No stack trace until now and further information.

    I guess that this is related to #109437 where we had an
    issue with restriction DI more generic in case tableMapping
    of a table to a secondard connection has been configured
    but no “ext_tables.sql/DefaultTcaSchema (TCA)” for that
    table exists.

    One query failed during QueryBuilder creation because of
    the general added TcaSchemaFactory as injected services
    to all the restriction container.

    Did not found other queries during DatabaseAnalyzer leading
    to that issue and I would connect to this.

    That was solvable in main because a `EmptyRestrictionContainer`
    has been introduced in main along with adding TcaSchemaFactory
    as DI dependency to the restriction handling and coould be set
    enforced and having some lowlevel fallbacks for connection pool
    set.

    Going to look into this if we can backport the new container
    and fix at least to v13, but I fear not to v12 or later.

    I would really suggest to make the required services `public: true`
    and use `GeneralUtility::makeInstance()` instead of constructor
    injection for custom restriction enforced meanwhile.

  5. Helmut Hummel commented <span data-processor="relativetime" data-value="2026-04-14T09:52:25+00:00" > 04/14/26, 09:52 </span>

    This would be resolved with a oneliner, when we consistenly change all $this->lateBootService->loadExtLocalconfDatabaseAndExtTables() calls to not reset the container, which was done in installer for v14 to allow import to work.

    It is a design decision to boot TYPO3 fully in install tool, but keep the failsafe container in GeneralUtility.
    I’m not sure why this decision was taken, but given this bug and the latest change in installer makes me think, that it would be more logical
    to expose the full container in GU once TYPO3 is fully booted in general. Full boot means that there is userland code active and this userland code might rely on fully booted DI, which is not possible to receive in all places where TYPO3 code calls makeInstance for user code.
    Query restrictions might be only one example

  6. Gerrit Code Review pushed patch set 1 for main to change 93665 status Needs Feedback Under Review <span data-processor="relativetime" data-value="2026-04-14T12:51:49+00:00" > 04/14/26, 12:51 </span>

  7. Stefan Bürk commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-04-16T16:40:11+00:00" > 04/16/26, 16:40 </span>

    Applied in changeset commit:5d2d23be020178f11264a226827c3369673e0523.