Bug #105433
closedCache identifier built by GreedyDatabaseBackend too long, causes exception
100%
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.
Updated by Gerrit Code Review 29 days ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86752
Updated by Gerrit Code Review 29 days ago
Patch set 1 for branch 13.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86754
Updated by Anonymous 29 days ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 9f018421661b3b0b15c4e4cf4dc701de87b1d905.