I'm getting the following error when clearing caches:

Notice: Undefined index: controller class in entity_type_supports() (line 84 of drupal-7/sites/all/modules/contrib/entity/entity.module).

followed by a bunch of warnings that are spun from this initial error.

The problem is this line of code:

  if ($op != 'access') {
    return in_array('EntityAPIControllerInterface', class_implements($info['controller class']));
  }

The errors are resolved when we wrap this call to class_implements in a second if statement, as so:

  if ($op != 'access') {
    if (array_key_exists('controller class', $info)) {
      return in_array('EntityAPIControllerInterface', class_implements($info['controller class']));
    }
  }

I've included a patch that provides the same kind of protection for revision delete.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dman’s picture

I'm seeing this still today, though I'd not encountered it before.
FWIW, it seems to be triggered for me when entity_type_supports() is called with entity_type 'bean'.
Which is odd, as I don't have 'bean' on my system. I did just install uuid_features and I suspect that is being messy.

However, it still would make sense to use this robust patch to clean up unexpected situations.
(When I'm lazy about undefined indexes that aren't really a problem, I sometimes just squash the notice with a @ - that works too.)

jenlampton’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
908 bytes

new patch. this one applies cleanly.

donquixote’s picture

I'm using another patch locally, but this looks good too.
Main thing is to return FALSE if there is no controller class. Which this patch does.

(I did not actually test, so can't rtbc)

das-peter’s picture

AlfTheCat’s picture

Tried the patch but no luck. It applied but didn't resolve the problem for me.