Fatal error: Class name must be a valid object or a string A "Fatal error: Class name must be a valid object or a string […] common.inc" appears on every page on the backoffice.

We don't how to reproduce this because it happens suddenly. When I've done a var_dump() of $class, and $entity_type, this is the result I obtained:


    string 'user' (length=4)
    TaxonomyTermController
    string 'taxonomy_term' (length=13)
    string 'user' (length=4)


The debug code has been added to entity_get_controller().

function entity_get_controller($entity_type) {
  $controllers = &amp;drupal_static(__FUNCTION__, array());
  if (!isset($controllers[$entity_type])) {
    $type_info = entity_get_info($entity_type);
    $class = $type_info['controller class'];
    echo $class; 
    var_dump($entity_type);
    $controllers[$entity_type] = new $class($entity_type);
  }

  return $controllers[$entity_type];
}


It seems that $type_info['controller class'] doesn't exist for "User".

This problem is solved when we flush the cache_bootstrap (via DELETE FROM cache_bootstrap) and cache (via DELETE FROM CACHE), but this is a temporary solution because it appears again.

It's a big problem for us. Any idea will be really appreciated.
The function entity_get_info() is responsible for gathering up this data about your entities. I would try to debug that one, and see what goes wrong.

You will want to have just cleared the cache when you do this, or you debug results will not be correct.

Can't think of a better answer to the question that is still generic enough to be useful for someone else.