hook_flush_caches should not assume cached data is valid

Created on 18 October 2015, almost 10 years ago
Updated 19 August 2025, 5 days ago

Error message:

WD php: FieldException: Attempt to create field name commerce_license[error] which already exists, although it is inactive.

The problem is in commerce_license_configure_line_item_types. field_info_field returns nothing if the field is inactive. Attempt to create then fails.

Not sure exactly how to get the inactive field. In my case it was after restoring the site from backup.

Maybe prior to create, the code needs to call

field_read_fields(array('field_name' => $field_name), array('include_inactive' => TRUE))

and if this succeeds, set active to TRUE and call field_update_field instead of creating.

I was rather in a hurry when I hit this last time :-) so didn't have time to make and test a fix. The problem seems to go away if you "fiddle around with things". I think maybe I ran the restore from backup again.

πŸ› Bug report
Status

Closed: outdated

Version

1.3

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom adamps

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024