Change record status: 
Project: 
Introduced in branch: 
7.x-3.x
Introduced in version: 
7.x-3.4
Description: 

Several of the Flag data API functions have static caching to improve performance. During the process of flagging an entity, these caches are cleared since the underlying data is changing.

The order in which these caches are cleared has been changed. This has been done to fix a bug with these functions returning stale data if they were called by a hook implementation or a rule that is invoked during the process of flagging an entity.

If you were using Flag data API functions from hook implementations or rules, then the data these return may have changed. Any workaround you may have implemented to ensure correct data should be removed.

The following hooks and Rules events are affected:

  • The hook hook_entity_insert(), which is invoked when an entity is flagged, for the newly created Flagging entity.
  • The hook hook_flag_flag(), which is invoked when an entity is flagged.
  • The Rules event flag_flagged_FLAG_NAME, which is invoked when an entity is flagged.

The following API functions are affected:

  • flag_get_entity_flags(): This now will correctly return data containing the flagging record for the flagging operation that is currently being performed. Previously, its data did not contain this flagging record.
  • flag_get_user_flags(): This now will correctly return data containing the flagging record for the flagging operation that is currently being performed. Previously, its data did not contain this flagging record.
  • flag_get_counts(): This will now return a count for the flag which includes the flagging which is being performed. Previously, the count returned did not include this.
  • flag_get_flag_counts(): This will now return a count for the flag which includes the flagging which is being performed. Previously, the count returned did not include this.
  • flag_get_entity_flag_counts(): This will now return a count for the flag which includes the flagging which is being performed. Previously, the count returned did not include this.
  • flag_get_user_flag_counts(): This will now return a count for the flag which includes the flagging which is being performed. Previously, the count returned did not include this.
Impacts: 
Site builders, administrators, editors
Module developers