Upadting salsa_entity module Fatal error: Class name must be a valid object or a string in /includes/common.inc on line 7657

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
rakesh.gectcr's picture

Somebody please help me , Its very urgent ..

When I am updating the New Salsa_Entity module ,
I am getting this error

Fatal error: Class name must be a valid object or a string in /includes/common.inc on line 7657

Thanks in advance
Rakesh James

Comments

Make sure to run update.php

Berdir's picture

Make sure to run update.php to clear the caches.

Also, please use the issue queue for support questions and not this group.

Thanks for the reply

rakesh.gectcr's picture

I run update.php then only i am getting this error.

Surely i will use the issue queue but i asked couple of question that is not answered over there. I urgently want to Configure the Donation through salsa. There i am getting another
error is
Exception: Failed to save entity salsa_supporter_my_donate_page: You need to pick a campaign to associate this page with in SalsaController->save() (line 128 of /sites/all/modules/salsa_entity/salsa_entity.inc).

Is there any proper documentation for this ?

Thanks is advance
Rakesh james

Rakesh James

Issue queue

Thanks miro

rakesh.gectcr's picture

Thanks miro

Rakesh James

saw it too

dvandusen's picture

This issue has been raised and closed (without repair) a huge number of times (more than 50 that I can see). It is, admittedly, a tough one to find. Please fix the issue. I have tracked down the actual cause, but the intricacies of the cache are a bit beyond me.

Clearing the cache could help here. Sadly, you can't always get there, largely because drush cc will also blow up when this error is occurring. So will anything having to do with accessing a user (in my case). . Requiring a user to clear the cache every time this occurs is improper by its nature - you can't have a user do a workaround as a normal course of business.

This is the tip of the iceberg on this problem. (the PHP Fatal error: Class name must be a valid object or a string in /includes/common.inc on line 7522).

[[in 7.28, at line 7855, 6 = ]]
$class = $type_info['controller class'];
$controllers[$entity_type] = new $class($entity_type);

The symptom appears because the search for the element ['controller class'] is presumed to be successful. It is not, and no secondary message (such as in a try / catch or an actual test here) is generated.

The issue stems from, for whatever reason, not being able to obtain a $class value from the $type_info array by executing module_invoke_all('entity_info'). Certainly a call time pass by reference could do it, but that would normally be caught. The actual problem is in /includes/common.inc at 7644.

      if (empty($entity_info)) {
        if ($cache = cache_get("entity_info:$langcode")) {
          $entity_info = $cache->data;
        }
        else {
          $entity_info = module_invoke_all('entity_info');
          // Merge in default values.
          foreach ($entity_info as $name => $data) {
            $entity_info[$name] += array(
              'fieldable' => FALSE,
              'controller class' => 'DrupalDefaultEntityController',
              'static cache' => TRUE,
              'field cache' => TRUE,
              'load hook' => $name . '_load',
              'bundles' => array(),
              'view modes' => array(),
              'entity keys' => array(),
              'translation' => array(),
            );
            $entity_info[$name]['entity keys'] += array(
              'revision' => '',
              'bundle' => '',
            );
            foreach ($entity_info[$name]['view modes'] as $view_mode => $view_mode_info) {
              $entity_info[$name]['view modes'][$view_mode] += array(
                'custom settings' => FALSE,
              );
            }
            // If no bundle key is provided, assume a single bundle, named after
            // the entity type.
            if (empty($entity_info[$name]['entity keys']['bundle']) && empty($entity_info[$name]['bundles'])) {
              $entity_info[$name]['bundles'] = array($name => array('label' => $entity_info[$name]['label']));
            }
            // Prepare entity schema fields SQL info for
            // DrupalEntityControllerInterface::buildQuery().
            if (isset($entity_info[$name]['base table'])) {
              $entity_info[$name]['schema_fields_sql']['base table'] = drupal_schema_fields_sql($entity_info[$name]['base table']);
              if (isset($entity_info[$name]['revision table'])) {
                $entity_info[$name]['schema_fields_sql']['revision table'] = drupal_schema_fields_sql($entity_info[$name]['revision table']);
              }
            }
          }
          // Let other modules alter the entity info.
          drupal_alter('entity_info', $entity_info);
          cache_set("entity_info:$langcode", $entity_info);
        }
      }

Notice that if the condition is true in the if at

if ($cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

then the module_invoke_all('entity_info') is never executed.
It just happens that the condition is always met after some other processing is done to create the cache. That means that there is no way to get the entity_info set up --- in my case there was no way to obtain the 'user' entity info, causing the original error above. I made the 'else' one level higher (took out the 'else {}') for testing, and everything worked as it should to clear the error.

I believe that the real bug is that the checking of cache is less than adequate, and that a check on the existence of the entity_info about the specific entity being searched for is needed. In fact, it may be justifiable to also search for the element ['controller class'] for that entity in the entity_info stored in cache.
D

use the issue queue

miro_dietiker's picture

@dvandusen: I can't find a reference / link to the issue you're talking about.
And as Berdir pointed out earlier already: Switch to the issue queue with this discussion. No one will solve your problem here.

Salsa

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: