98009[BUGFIX] Improve handling of error pages that are not available
Commit message
Show more Show less
Review
-
Code review CR +2 Done
- Benni Mack +2
- Garvin Hicking +1
-
Verified V +2 Done
- Benni Mack +2
- Garvin Hicking +1
- core-ci +1 CI
Issues 3
Files 4
- typo3/sysext/core/Classes/Error/PageErrorHandler/PageContentErrorHandler.php+54 −18
- typo3/sysext/core/Tests/Functional/Error/PageErrorHandler/Fixtures/ExternalErrorPageRequestHandler.phpnew+43 −0
- typo3/sysext/core/Tests/Functional/Error/PageErrorHandler/Fixtures/NotFoundPageWithoutPageObject.typoscriptnew+3 −0
- typo3/sysext/core/Tests/Functional/Error/PageErrorHandler/PageContentErrorHandlerTest.php+236 −7
Review log 818
-
Matthias Vogel uploaded patch set 1 11/25/26, 11:15
-
core-ci voted on patch set 1 V -1 11/25/26, 11:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115415
-
core-ci commented on patch set 1 11/25/26, 12:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115415
-
Matthias Vogel rebased onto patch set 2
V -111/25/26, 13:10 -
core-ci voted on patch set 2 V -1 11/25/26, 13:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115442
-
core-ci commented on patch set 2 11/25/26, 13:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115442
-
core-ci commented on patch set 2 11/25/26, 13:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115442
-
core-ci commented on patch set 2 11/25/26, 13:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115442
-
core-ci commented on patch set 2 11/25/26, 14:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115442
-
core-ci voted on patch set 2 V +1 11/25/26, 14:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115442
-
Benjamin Kott uploaded patch set 3
V +111/27/26, 01:41 -
Benjamin Kott commented on patch set 3 11/27/26, 01:41
Patch Set 3: Rebased onto current main and reviewed the change in depth. Thanks, the fix looks good to me. What changed compared to patch set 2: * Rebase: "[BUGFIX] Keep preview simulation on the error page" (2b54d06fd82) added tests to PageContentErrorHandlerTest in the meantime. The conflict was only in the imports and in the tests appended at the end of the class; both sides are kept. PageContentErrorHandler itself applied without conflict and keeps the preview parameters of that fix. * hiddenErrorPageIsShownToBackendUser now logs the backend user in with a real session cookie, as errorPageSubRequestKeepsPreviewSimulationOfBackendUser on main already does. Both tests share the new helper withBackendUserSession(). That way the regular authentication resolves the live workspace, the workaround with InternalRequestContext::withWorkspaceId(0) and its comment are gone, and the test exercises the same path as a real backend user. I checked that the test still fails without the change in PageContentErrorHandler. * typo3ErrorPageGetsContentSecurityPolicyThatAllowsItsInlineStyle asserts that the nonce is found in the body before it uses it, so a missing nonce fails with a clear message instead of the `?? ''` fallback. The production code and the commit message are unchanged. Run on the rebased patch set: functional tests (SQLite) for PageContentErrorHandlerTest (16 tests, 10 of them fail without the fix), frontend SiteHandling, core Error and core Site (2722 tests, green); cgl -n, checkIntegrityPhp, listExceptionCodes are green. PHPStan reports only an internal reflection error in SchedulerTaskRepository, unrelated to this change. The patch also applies cleanly to 14.3. Notes that I did not change, for you to decide: * Only the sub-request path logs a warning. When an external error page (errorContentSource is a URL) fails, the handler still answers silently with the TYPO3 error page. A warning there as well would help integrators in the same way; could also be a follow-up. * The fallback page is always HTML. ErrorController::handleError() answers a JSON response for `Accept: application/json`. That was the same before this change, just mentioning it. * PageContentErrorHandler in EXT:core now uses the @internal ContentSecurityPolicyHeaders of EXT:frontend. It already depends on Frontend\Http\Application, so this adds no new direction, but it is one more core-to-frontend reference. -
core-ci voted on patch set 3 V +1 11/27/26, 01:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115645
-
Matthias Vogel uploaded patch set 4
V +111/27/26, 09:59Hi Benjamin, thank you for the improvements to the tests. 1. Warning for the external error page: Done in this patch set. When the external request fails, the handler now logs a warning with the URI. The warning also gives the status code or the error message of the request. Two new functional tests cover this. Also, the handler now gets its logger from LogManager in the constructor. It does not use LoggerAwareInterface and LoggerAwareTrait anymore. 2. Fallback page is always HTML: This was the same before this change. The old fallback was also an HTML response. A JSON answer for "Accept: application/json" is a new feature. I think it is out of scope for this bugfix. We can open a separate issue for it. 3. Core uses the @internal ContentSecurityPolicyHeaders of ext:frontend: I want to keep this for this bugfix. PageContentErrorHandler already depends on ext:frontend, because it uses Frontend\Http\Application for the sub-request. A clean core API for the Content-Security-Policy of an error response is a larger change. It should be a separate change. -
core-ci voted on patch set 4 V +1 11/27/26, 10:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115702
-
Garvin Hicking voted on patch set 4 CR +1 V +1 11/27/26, 10:57
-
Benni Mack voted on patch set 4 CR +2 V +2 11/28/26, 10:49
-
Benni Mack merged patch set 5 11/28/26, 10:49