1. Install Drupal, ERS and CTools, and enable ERS for the default Article content type.
2. Create an article, leaving the image field blank.
3. Edit the draft and add an image.
4. Attempt to publish the draft immediately.
Result:
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /.../includes/entity.inc).
Notice: Trying to get property of non-object in file_field_presave() (line 220 of /.../modules/file/file.field.inc).
Notice: Undefined property: stdClass::$uri in file_save() (line 573 of /.../includes/file.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /.../includes/entity.inc).
Notice: Trying to get property of non-object in image_field_presave() (line 215 of /.../modules/image/image.field.inc).
Notice: Undefined property: stdClass::$fid in file_usage_add() (line 657 of /.../includes/file.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 19 file_usage.fid may not be NULL: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (?, ?, ?, ?, ?); Array ( [0] => [1] => file [2] => node [3] => 1 [4] => 1 ) in file_usage_add() (line 664 of /.../includes/file.inc).
If I edit the draft, the image field is empty in the edit form. If I then save it (without the image), I can subsequently publish it without errors. If I attempt to add the image again, the errors return.
Comments
Comment #1
john morahan commentedNever mind, it's a core bug.
Comment #2
john morahan commentedHmm maybe it's not. I assumed this because the problem remained after I disabled ERS, but I can't seem to trigger it without enabling ERS first, even if it's disabled afterwards.
Comment #3
Paul Kim Disney commentedSo the issue is that node_save ultimately calls file_delete too aggressively. It assumes that node revisions no longer needs an entry in file_usage. Patch coming shortly.
Comment #4
Paul Kim Disney commentedComment #5
merlinofchaos commentedNo patch yet. Did you mean to attach one?
Comment #6
paul kim consulting commentedPatch forthcoming...need to get permission from higher ups...
Comment #7
merlinofchaos commentedFixed by http://drupalcode.org/project/ers.git/commit/6fc5435ff3ba60c9bd29b07f2f1...