Review main Ready for review Quiet

96308[BUGFIX] Treat missing pages like deleted in modules

Georg Tiefenbrunn CR -1 V 0 Easy +35 −0 updated 10/07/26, 19:14

Commit message

BackendModuleValidator lets a module request for a deleted page pass,
but throws #1289917924 "You don't have access to this page"
for a page id that does not exist at all.

Deleting a page that was created in a workspace removes the record
instead of marking it deleted.
The backend still refers to the page afterwards.
The context menu reloads the content frame with its id,
and the module state keeps it, so the next module switch fails as well.
The same happens for any stale or mistyped id.

A page which does not exist is now handled like a deleted page,
and the module shows its "no page selected" state.
Existing pages without access still throw.
That a missing id passes tells the user no more than FormEngine
already does with "not found" vs. "no permission".

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 1
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/08/96308/1 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/08/96308/1 && git cherry-pick FETCH_HEAD

Review

  • Code review CR -1 Needs a vote
    • Benni Mack -1
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Merge conflicts 4

Issues 1

Files 2

Review log 34

  1. Georg Tiefenbrunn uploaded patch set 1 10/02/26, 11:37

  2. core-ci voted on patch set 1 V +1 10/02/26, 11:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109924

  3. Benni Mack commented on patch set 1 CR -1 10/07/26, 16:31

    BackendModuleValidator.php:255

    this way, we use BackendUtility::getRecord() twice in 4 LoC. I think we should improve this.
  4. Georg Tiefenbrunn commented on patch set 1 10/07/26, 19:14

    BackendModuleValidator.php:255 Reply Unresolved

    doesUserHaveAccess() on the fetched row is not equivalent: calcPerms() additionally requires a web mount (fails for deleted pages) and grants nothing without user groups, so deleted pages with show permission get rejected. A single query works if the perms clause is evaluated in SQL: one unrestricted lookup selecting the delete field and CASE WHEN <perms clause> THEN 1 ELSE 0 END. It passes on SQLite, MariaDB, PostgreSQL and MySQL, but adds a literal SQL fragment, a ConnectionPool dependency and more code. This path only runs after readPageAccess() failed, so the second lookup is cheap. Keep the two getRecord() calls (optionally reordered, existence check only when the perms lookup finds nothing), or move the check into SQL? Either way I'd add tests for deleted pages with and without show permission, which are missing so far.