Review main Merged

82452[TASK] Streamline TypoScriptFrontendItitialization

Christian Kuhn CR +2 V +2 Expert +993 −768 updated 01/18/24, 11:32

Commit message

This patch is the result of a careful refactoring of
the TypoScriptFrontendInitialization 'body' methods.

The patch establishes the new PageInformationFactory
which does all the main lifting. It either returns
the verified PageInformation object, or throws an
early dedicated exception carrying a response from the
ErrorController when something went wrong (access
checks, language overlays ...), or a StatusException
when ErrorController itself error'ed.

When PageInformation could be determined, rendering
is dispatched to middlewares below. In case of error,
the code flow is streamlined to always *return* the
early response, so upper middlewares can kick in. This
was a mixed bag before, where such exceptions sometimes
bubbled up, skipping upper middlewares.

While most error scenarios are covered by the complex
'SiteHandling' related functional tests already, a set
of simple additional tests is set up to check for
casual things in a more obvious way.

Note the internal code flow within PageInformationFactory
can still be simplified and disentangled some more, but
the outer class communication is fine now and the
internal handling is already much more easy to follow.

As drive-by, @internal getUriToCurrentPageForRedirect()
is moved from TSFE to the consuming 'shortcut and
mountpoint redirect' middleware.

The patch also outlines flaws of the PageRepository
strategy, that becomes obvious after disentangling the
consuming code. It adds a todo on how PageRepository
could be improved. We should follow this path soon, since
the entire area with all the access and logic checks is
security relevant: We want to end up with code that is as
easy to grasp and follow as possible.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 2

Files 27

Show 7 more files