So I was working away at trying to solve the problem I asked about in How can I combine the fields of two field collections in my theme? when suddenly Drupal died with this error message:

Fatal error: Call to undefined function entity_get_info() in /path/to/drupal/sites/all/modules/entity/includes/entity.inc on line 57

This is the call stack.

call stack

Now since it seems to die when working with the field collection module, and I was working with that field, it is obvious that something I did caused the entire site to crash, but how, and how can I recover from it? I can't clear cache to try to see if that fixes anything because drush throws the same error and I can't access the cache clear on the site itself obviously.

What I was doing

I was working on the theme_preprocess_field() function and had something like this:

function enviroscope_preprocess_field(&$variables) {
    $roles = array();
    if ($variables['field_name_css'] == 'field-doc-staff-contrib-fc') {
        foreach ($variables['items'] as $item) {
            $role = array_values($item['entity']['field_collection_item'])[0]['field_fc_doc_iges_role'][0]['#markup'];
            $user = array_values($item['entity']['field_collection_item'])[0]['field_fc_doc_iges_user'];
            $toreplace = $user['#object']->field_fc_doc_iges_user['und'][0]['entity']->name;
            $replacewith = $user['#object']->field_fc_doc_iges_user['und'][0]['entity']->field_user_family_name['en'][0]['#safe_value']
            $roles[$role][] = $item;

I started adding some scaffolding for the next step, which was to be examining the field-doc-other-contrib-fc field collection field.

I meant to modify the code after kpr($roles); to read as follows:

    variable_set('roles_to_pass', $roles);
} else if ($variables['field_name_css'] == 'field-doc-other-contrib-fc') {
    $roles = variable_get('roles_to_pass', array());
    // sort and mix these together

My best guess about what possibly could have happened is that I accidentally wrote else if ($variables['field_name_css'] = 'field-doc-other-contrib-fc') { (note the = instead of the ==) which would have reset the field_name_css on every field except the first field collection field I was working on. Would this explain the entire site going down in the way it has? How can I recover from it?

In the morning if there is no answer I'll try deleting all rows from the various cache_* tables directly in the database, but for now I need to hit the hay.


Clearing out the cache tables and commenting out my entire template.php had no effect. Is my entire install hosed?

1 Answer 1


You have a classed FieldCollectionItem object in your variables table. Drupal 7 isn't designed to handle this.

When you use variable_set() to save an object to the variables table, the object must first be converted into a string using serialize(). Later, it will have to figure out how to convert that string back into a FieldCollectionItem object, and it will call the __wakeup magic method on the class to help it figure out how to do that. It turns out that __wakeup method requires code that isn't bootstrapped yet at the time that Drupal reads from the variables table, so you get the fatal error.

But you're not hosed. It looks you probably saved the object in the 'roles_to_pass' variable. If you can edit your database, try removing that record from the {variable} table, then clear your cache tables.

  • 1
    you are my favorite person in the world right now! Now, I wonder if you might be able to help me accomplish what I'm trying to do in the question referenced at the beginning of this one? Basically I need to sort and combine two sets of field collections. (drupal.stackexchange.com/questions/189207/…)
    – UltraBob
    Feb 6, 2016 at 4:48
  • 1
    I suppose I probably just need to save the ids and load them back up again in the next field, though how to do the reloading (and the rendering at the end) is beyond my current understanding.
    – UltraBob
    Feb 6, 2016 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.