Skip to content

[BUGFIX] Handle deleted pages in DatamapHook - #481

Merged
lochmueller merged 1 commit into
lochmueller:mainfrom
magicHatOfTYPO3:fix/datamap-hook-deleted-page
Nov 20, 2026
Merged

lochmueller merged 1 commit into
lochmueller:mainfrom
magicHatOfTYPO3:fix/datamap-hook-deleted-page

Conversation

@magicHatOfTYPO3

Copy link
Copy Markdown
Contributor

Short description

DatamapHook::processDatamap_afterDatabaseOperations() reads the updated page with
BackendUtility::getRecord() and accesses tx_staticfilecache_cache directly. For a deleted
page, getRecord() returns null:

PHP Warning: Trying to access array offset on null in .../staticfilecache/Classes/Hook/DatamapHook.php line 32

With the default exceptionalErrors this ends in an exception, so the backend request fails.

A page without record is now treated like a page which must not be cached: its static cache is
flushed, which is the right thing for a deleted page anyway.

Related Issue

None. We saw this in production when an admin changed the group of an already deleted page in the
Access module (the module still showed the page). The DataHandler stores the update for admins,
then the hook fails.

More Details

  • The record is read in the new protected method getPageRecord(), so the hook can be tested
    without database.
  • New unit test testCacheIsFlushedIfPageIsNotCacheable covers cacheable, not cacheable and
    deleted pages. Without the fix the deleted page case fails with the warning above.
  • Not a work in progress, no open issues.

🤖 Generated with Claude Code

BackendUtility::getRecord() returns null for a deleted page. If such a
page is updated (e.g. an admin changes its permissions in the Access
module from an outdated view), the hook accessed an array offset on
null, which TYPO3 turns into an exception. A page without record is
now treated like a page which must not be cached, so its static cache
is flushed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lochmueller
lochmueller merged commit 445122a into lochmueller:main Nov 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants