I created a field, created an instance, and created a node with that field. I then deleted the field, then deleted the node. I looked at the db and saw no (marked deleted) data for the field on the node (I guess it got really deleted along with the node even though the field was deleted?), and a marked-deleted instance and field. So that's all fine.
I then ran cron in the browser to purge the instance and field, and got:
FieldException: Attempt to purge a field that still has instances. in field_purge_field() (line 912 of /Users/bjaspan/drupal/head/modules/field/field.crud.inc).
Well, indeed, the instance is still in the db, marked deleted. With no data the instance should have already been purged, and then anyway field_purge_field() should not have be call while a (deleted) instance still exists.
Comments
Comment #1
Nephele commentedI just got the same error message using version 7.0-rc1, under the same type of scenario.
Specifically, I created a field, put data in it, deleted the entire field definition, then re-created the field and re-filled it (because I loaded a set of incorrect data into the field, so I just wanted to clear out all the incorrect data and start over). When I later opened admin/config, the following error messages were displayed at the bottom of the page:
* Warning: Cannot modify header information - headers already sent by (output started at /var/www/drupal7/includes/common.inc:2532) in drupal_send_headers() (line 1042 of /var/www/drupal7/includes/bootstrap.inc).
* FieldException: Attempt to purge a field field_meas that still has instances. in field_purge_field() (line 1141 of /var/www/drupal7/modules/field/field.crud.inc).
The website encountered an unexpected error. Please try again later.
(I also noticed that this is a near-duplicate of #978944: Handle exceptions thrown in cron, but given some differences in the details, I'm not sure whether one can be closed as a duplicate)
Comment #2
yched commentedBumping to major. Possibly even critical.
Simpler steps to reproduce :
- create a field on 'article' node type
- create a node with data for the field
- delete the field through Field UI
- run cron :
FieldException: Attempt to purge a field field_meas that still has instances
Comment #3
yched commentedActually, this is fixed by the patch in #915906: Deleting node type with only instance of a field leaves the field in a strange zombie state.
field_purge_batch() uses a flawed logic to determine if it should call field_purge_field().
Comment #4
yched commented