- πΊπΈUnited States smustgrave
wanted to bump 1 more time before closing.
Symptom:
After saving an existing node or other entity, further access checks on that entity are incorrect for the remainder of the request.
Occurs more often when you have some custom access logic in hook_node_access(), hook_node_access_record(), hook_entity_access(), etc.
NOTE: This only happens with subsequent access checks within the same request.
Problem:
EntityAccessControlHandler statically caches calls to ::access(). There appears to be no invalidation of that cache when an entity is updated.
Steps to reproduce:
See patch with test.
Invalidate the static access cache (EntityAccessControlHandler::$accessCache) for an entity when the entity is updated.
It's not clear how/where that invalidation should happen.
Workaround:
Manually invalidate the entire static cache before subsequent access checks.
Drupal::entityTypeManager()->getAccessControlHandler('ENTITY_TYPE')->resetCache();
This can incur a performance hit since it resets the cache for ALL access checks.
Postponed: needs info
11.0 π₯
entity system
Used to track the progress of issues reviewed by the Drupal Needs Review Queue Initiative.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
wanted to bump 1 more time before closing.