When creating a file, the following code in entity_make_entity_local() unsets the file's fid property.
// Fetch the local ID by its UUID.
$ids = entity_get_id_by_uuid($entity_type, array($entity->{$uuid_key}));
$id = reset($ids);
// Set the correct local ID.
if (empty($id)) {
unset($entity->{$id_key});
$entity->is_new = TRUE;
}
else {
$entity->{$id_key} = $id;
$entity->is_new = FALSE;
}
When file_entity_access() is called during the create process, it checks the fid property. Since it no longer exists on the file object, we get the following PHP notice:
Notice: Undefined property: stdClass::$fid in file_entity_access() (line 1616 of /var/www/test/htdocs/sites/all/modules/contrib/file_entity/file_entity.module).
Since uuid.entity.inc's entity_make_entity_local() is manipulating the structure of a file_entity object (removing fid property), I decided to make this a uuid issue instead of a file_entity issue.
I'm thinking this is a simple fix by added fid = null to the entity in uuid.core.inc's file_entity_uuid_presave().
Comment | File | Size | Author |
---|---|---|---|
#1 | fid_undefined_property_fix-2300301-1.patch | 1022 bytes | dkingofpa |
Comments
Comment #1
dkingofpa CreditAttribution: dkingofpa commentedPatch attached.
Comment #3
skwashd CreditAttribution: skwashd at Dave Hall Consulting for Dave Hall Consulting commentedThanks for the patch. I've committed it.