Project

General

Profile

Actions

Bug #105433

closed

Cache identifier built by GreedyDatabaseBackend too long, causes exception

Added by Thomas Prangenberg 29 days ago. Updated 29 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Caching
Target version:
-
Start date:
2024-10-24
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.3
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

In TYPO3 13.4, GreedyDatabaseBackend builds a cache identifier based on a multitude of context properties. In addition to other things it adds all user group IDs of the current user imploded by an underscore.

This causes an exception if a user has more user groups assigned than the cache frontend can handle, due to the cache identifier exceeding the allowed length of 250 characters:


(1/1) #1233058486 InvalidArgumentException

"greedy_database_backend_sys_category-c81e728d9d4c2f636f067f89cc14862c-0-0-includeFloating-b2cc891e71394a0a49ed6afb55ef7905-0000-1729761340-0_-2_5650_5680_5687_5688_5692_5693_5707_5723_5736_5756_5757_5758_5759_5760_5761_5792_5793_5794_5797_5824_5828_5836_5837_5838_5839_5840_5841_5842_5980" is not a valid cache entry identifier.

in /var/www/html/vendor/typo3/cms-core/Classes/Cache/Frontend/AbstractFrontend.php line 85

Hashing the imploded string in https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Classes/Domain/Persistence/GreedyDatabaseBackend.php#L159 works as a workaround, though I'm not entirely sure if that is enough to prevent the problem since putting all of the cache id parts together could in theory still exceed the allowed length (it's highly variable). Maybe the entire result should be hashed before returning the cache id.

The issue can for example be reproduced by installing friendsoftypo3/content-blocks or any other usage of TYPO3\CMS\Core\Collection\LazyRecordCollection and assigning a very large number of user groups to a frontend user.

Actions

Also available in: Atom PDF