Review main Ready for review

97996[BUGFIX] Show one preview info box on error pages

Matthias Vogel CR +1 V +1 Normal +111 −1 updated 11/27/26, 22:28

Commit message

The site configuration can set a page of the site as the error page
for an HTTP status code. PageContentErrorHandler gets this page with
a sub-request. This sub-request runs through all frontend middlewares.

A backend user previews a workspace. The user requests a URI that
causes an error, for example a URI that has no page. The middleware
WorkspacePreview adds its info box in the sub-request and again in
the outer request. Thus the error page contains two boxes at the same
position.

The script for the change highlighting uses only the first box. The
second box covers the first box. Thus the checkbox in the visible box
has no effect.

PageContentErrorHandler now marks its sub-request with its own
request attribute. WorkspacePreview returns the response of this
sub-request without changes. WorkspacePreview adds the info box only
to the response of the outer request. The browser gets this response.
Show more Show less

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 4
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/96/97996/4 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/96/97996/4 && git cherry-pick FETCH_HEAD

Review

  • Code review CR +1 Needs a vote
    • Garvin Hicking +1
  • Verified V +1 Needs a vote
    • Garvin Hicking +1
    • core-ci +1 CI

Merge conflicts 4

Issues 1

Files 5

Review log 1014

  1. Matthias Vogel uploaded patch set 1 11/25/26, 08:24

  2. core-ci voted on patch set 1 V +1 11/25/26, 08:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115375

  3. Benjamin Kott uploaded patch set 2 V +1 11/27/26, 02:11

  4. Benjamin Kott commented on patch set 2 11/27/26, 02:11

    Patch set 2 rebases the change onto current main (62d2eb1c3d5). It applied without conflicts. The fix is unchanged. One change to the test: it now also asserts the data-live-url of the box that remains. The commit message keeps the box of the outer request on purpose, because only that box carries the URI the browser requested. The box of the sub-request carries the URI of the error page (/404), so its live URL and its link to stop the preview point there. The previous test counted the boxes only, so it also passed with a fix that keeps the box of the sub-request instead. I checked that: with such a variant the new assertion fails, and with your fix it passes. Verified locally on SQLite: without the fix the new test fails (2 boxes instead of 1). With the fix, Workspaces Tests/Functional/Middleware and EventListener and core Tests/Functional/Error pass, and cgl -n and checkIntegrityPhp are green. A note on the backport to 14.3, not changed here: 14.3 has no change highlighting script. Both boxes are added there too, but the outer box lies on top and carries the correct links. So the symptom the commit message describes (the checkbox has no effect) does not exist on 14.3. Please take a look at whether the message, or the backport, should say that.
  5. core-ci voted on patch set 2 V +1 11/27/26, 02:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115647

  6. Matthias Vogel uploaded patch set 3 V +1 11/27/26, 09:23

  7. Matthias Vogel commented on patch set 3 11/27/26, 09:24

    $Thank you, Benjamin, for the stronger test. The check of data-live-url makes sure that the outer box stays and the inner box goes.\n\nGarvin, thank you for the hint about originalRequest. This patch set removes this check. PageContentErrorHandler now sets its own attribute on the sub-request for the error page (PageContentErrorHandler::ERROR_PAGE_SUB_REQUEST_ATTRIBUTE, marked @internal). WorkspacePreview checks only this attribute. Other sub-requests that set originalRequest keep the info box. A new test shows this.\n\nAbout 14.3: I agree. On 14.3 the error page also gets two boxes. But the outer box is on top, thus the user sees no defect. I propose that the commit message of the 14.3 backport says that the change removes the duplicate box. The message for main stays as it is.
  8. Matthias Vogel commented on patch set 3 11/27/26, 09:24

    Thank you, Benjamin, for the stronger test. The check of data-live-url makes sure that the outer box stays and the inner box goes. Garvin, thank you for the hint about originalRequest. This patch set removes this check. PageContentErrorHandler now sets its own attribute on the sub-request for the error page (PageContentErrorHandler::ERROR_PAGE_SUB_REQUEST_ATTRIBUTE, marked @internal). WorkspacePreview checks only this attribute. Other sub-requests that set originalRequest keep the info box. A new test shows this. About 14.3: I agree. On 14.3 the error page also gets two boxes. But the outer box is on top, thus the user sees no defect. I propose that the commit message of the 14.3 backport says that the change removes the duplicate box. The message for main stays as it is.
  9. core-ci voted on patch set 3 V +1 11/27/26, 09:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115690

  10. Garvin Hicking commented on patch set 3 11/27/26, 10:53

    PageContentErrorHandler.php:47

    We use the identifier verbatim in most of the core code. I'd like to keep it that way, also to have it better greppable, to not introduce a constant for this.
  11. Matthias Vogel uploaded patch set 4 V +1 11/27/26, 11:14

    Use the request attribute name verbatim instead of a constant.
  12. Matthias Vogel commented on patch set 3 11/27/26, 11:14

    PageContentErrorHandler.php:47 Reply

    Done in patch set 4. The constant is gone. PageContentErrorHandler and WorkspacePreview now use 'frontend.errorPage.subRequest' verbatim.
  13. core-ci voted on patch set 4 V +1 11/27/26, 11:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115712

  14. Garvin Hicking voted on patch set 4 CR +1 V +1 11/27/26, 22:28