When the media module is enabled, a fatal error occurs, which is displayed at the bottom of every page in the site, and prevents Cron from running (it fails with the same error):

Fatal Error: Cannot access empty property in common.inc on line 7391

common.inc:

function entity_create_stub_entity($entity_type, $ids) {
  $entity = new stdClass();
  $info = entity_get_info($entity_type);
  $entity->{$info['entity keys']['id']} = $ids[0]; // Line 7391
  if (!empty($info['entity keys']['revision']) && isset($ids[1])) {
    $entity->{$info['entity keys']['revision']} = $ids[1];
  }
  if (!empty($info['entity keys']['bundle']) && isset($ids[2])) {
    $entity->{$info['entity keys']['bundle']} = $ids[2];
  }
  return $entity;
}

Other information I have come across is that this looks the same as issue #1008714: Fatal error: Cannot access empty property in [...]/includes/common.inc on line 7307 , however, there is no comment as to how this was resolved.
I also get the following message in the status log:

YPE	php
DATE	Monday, June 6, 2011 - 07:16
USER	Anonymous (not verified)
LOCATION	http://.../rss.xml
MESSAGE	Notice: Undefined index: entity keys in entity_create_stub_entity() (line 7391 of includes/common.inc).
SEVERITY	notice

Disabling the media, media_ui, and media_gallery plugins resolves this error.
Please let me know what additional information is helpful. Thanks in advance for any help.

Comments

kreynen’s picture

I saw this error when using media_gallery-beta4 with media-dev. Disabling media_gallery or updating to media_gallery-beta5 resolved the error.

bittu10’s picture

Hi,

I started getting below error in common.inc when I upgraded drupal 7.2 -> drupal 7.4
Fatal error: Cannot access empty property in /includes/common.inc on line 7399

I was also getting below errors
* Notice: Undefined index: bundles in field_info_bundles() (line 576 of modules/field/field.info.inc).
* Warning: Invalid argument supplied for foreach() in _field_info_collate_fields() (line 215 of modules/field/field.info.inc).
* Notice: Undefined index: label in ctools_context_entity_get_children() (line 39 of sites/all/modules/ctools/plugins/contexts/entity.inc).
* Notice: Undefined index: bundles in ctools_entity_form_field_content_type_content_types() (line 38 of sites/all/modules/ctools/plugins/content_types/form/entity_form_field.inc).
* Warning: Invalid argument supplied for foreach() in ctools_entity_form_field_content_type_content_types() (line 38 of sites/all/modules/ctools/plugins/content_types/form/entity_form_field.inc).
* Notice: Undefined index: bundles in ctools_entity_field_content_type_content_types() (line 38 of sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc).
* Warning: Invalid argument supplied for foreach() in ctools_entity_field_content_type_content_types() (line 38 of sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc).

All my error went away, when I disabled media_gallery module. But, kreynen, I was already using media_gallery beta5 version. So, I don't think, solution is to upgrade media_gallery.

Thanks
bittu10

beauz’s picture

I'm getting the same thing, drupal 7.4, media beta5.
Subscribing.

mirzu’s picture

I was able to fix this by doing the following:
1. disabling this module
2. disabling display suite and display suite extras
3. uninstalling the media module
4. running cron.
5. reenable all modules

Really feels like voodoo and I wish I had a better understanding of what the actual issue was, but maybe this'll help maintainers figure out what is going on. I didn't have any data loss and after reenabling both modules everything worked. I tested this on my local machine multiple times before trying it in production, and I was notable to skip any step.

grahamtk’s picture

subscribe

dave reid’s picture

Category: bug » support
omercioglu’s picture

I can fix the error by adding:
$entity_info['media']['entity keys']['id'] = 'fid'; to function "media_entity_info_alter".

dave reid’s picture

Status: Active » Fixed

The media entity no longer exists and were converted to file entities in 7.x-1.0-beta5.

Status: Fixed » Closed (fixed)

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