If no file types are defined, or returned by entity_get_info('file'), which seems to be the case during features update/revert commands run through drush, file_type_get_names() returns null. This results in numerous warnings stating:

Invalid argument supplied for foreach() file_entity.module:466

The function currently looks like:

function file_type_get_names() {
  $names = &drupal_static(__FUNCTION__);

  if (!isset($names)) {
    $info = entity_get_info('file');
    foreach ($info['bundles'] as $bundle => $bundle_info) {
      $names[$bundle] = $bundle_info['label'];
    }
  }

  return $names;
}

In hook_field_extra_fields(), it is assumed that an array is retuned:

function file_entity_field_extra_fields() {
  $info = array();

  foreach (file_type_get_names() as $type => $name) {
    $info['file'][$type]['form']['filename'] = array(
      'label' => t('File name'),
      ...

One or another needs to be changed.

Comments

roam2345’s picture

Status: Active » Needs review
StatusFileSize
new1.4 KB

here is a patch, took the second approach. This was littering my drush log far to much.

ParisLiakos’s picture

Status: Needs review » Fixed

thanks, commited

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.