Fatal error: Class name must be a valid object or a string in drupal-7.19/includes/common.inc

I am getting this error and I did a backtrace and got the following.
rules_config causes this
rules_config is defined in rules.install

backtrace:
[0] => Array
(
[file] => /var/aegir/platforms/7/servers/drupal-7.19/includes/common.inc
[line] => 7715
[function] => entity_get_controller
[args] => Array
(
[0] => rules_config
)

)

[1] => Array
(
[file] => /var/aegir/platforms/7/modules/all/entity/entity.module
[line] => 159
[function] => entity_load
[args] => Array
(
[0] => rules_config
[1] =>
[2] => Array
(
[plugin] => reaction rule
[active] => 1
)

)

)

[2] => Array
(
[file] => /var/aegir/platforms/7/modules/all/rules/rules.module
[line] => 669
[function] => entity_load_multiple_by_name
[args] => Array
(
[0] => rules_config
[1] =>
[2] => Array
(
[plugin] => reaction rule
[active] => 1
)

)

)

[3] => Array
(
[file] => /var/aegir/platforms/7/modules/all/rules/includes/rules.plugins.inc
[line] => 711
[function] => rules_config_load_multiple
[args] => Array
(
[0] =>
[1] => Array
(
[plugin] => reaction rule
[active] => 1
)

)

)

[4] => Array
(
[file] => /var/aegir/platforms/7/modules/all/rules/rules.module
[line] => 257
[function] => rebuildEventCache
[class] => RulesEventSet
[type] => ::
[args] => Array
(
)

)

Comments

ptmkenny’s picture

Status: Active » Postponed (maintainer needs more info)

Please provide steps requiring the Rules configuration required to reproduce this error. A backtrace alone is not sufficient to actually begin to fix the problem.

travis uribe’s picture

I encountered this issue simply by enabling Rules and Rules UI in the modules screen at /admin/modules

The error is occurring in entity_get_controller() in includes/common.inc at line 7787 in a Drupal 7.21 installation. The issue is that $type_info['controller class']; returns a NULL value.

    $type_info = entity_get_info($entity_type);
    $class = $type_info['controller class'];
    $controllers[$entity_type] = new $class($entity_type);

I'm confused as to why this is happening, as rules_entity_info() clearly defines a controller class for the rules_config entity

travis uribe’s picture

Priority: Normal » Critical

This is a pretty significant issue, because now that I've encountered the error, my entire website is being killed by it. Every single page produces this fatal error.

travis uribe’s picture

It appears the hook rules_entity_info() is not running at all. I inserted die(__FUNCTION__); before the return statement therein, and the function is never called. I had to do some hacking to even get to the point where I could disable and uninstall and then reinstall the module in the first place.

ptmkenny’s picture

Status: Postponed (maintainer needs more info) » Active

Which version of Entity API are you running?

travis uribe’s picture

Status: Active » Postponed (maintainer needs more info)

Entity API 7.x-1.1

travis uribe’s picture

I thought maybe it was a problem of APC caching, as that happens frequently. But I reset it and tried again and got the same issue.

ptmkenny’s picture

Status: Postponed (maintainer needs more info) » Active
ptmkenny’s picture

Issue summary: View changes

edited original message to define where rules_config is defined

ragnarkurm’s picture

Just adding my experience with this issue.
Upgraded rules from 2.3 to 2.6

  1. Got WSOD.
  2. mysql> delete from cache;
  3. Then got
    PHP Fatal error: Unsupported operand types in /.../html/sites/all/modules/rules/rules.module on line 227
  4. vi /.../html/sites/all/modules/rules/rules.module
  5. added comment to line 227:
    # $data[$hook] += rules_discover_plugins($discover[$hook]);
  6. drush cc all
  7. vi - removed the comment put earlier
  8. ran again drush cc all
  9. Whewww... got rid of WSOD.
pwaterz’s picture

I ran into this same issue

I turned rules off
cleared cache
turned rules on

and it went away

Entity API version
7.x-1.0

Alan D.’s picture

Shame Rules is a dependency on heaps of stuff :/

$ drush registry-rebuild
Drush command terminated abnormally due to an unrecoverable error.

Error: Class name must be a valid object or a string in includes\common.inc, line 7885

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

Call Stack:
    0.0000     150888   1. {main}() drush.php:0
    0.0190    1603008   2. drush_main() drush.php:16
    0.2410    4327216   3. _drush_bootstrap_and_dispatch() drush.php:61
    0.2830    4328688   4. drush_bootstrap_to_phase() drush.php:78
    2.4211    6308032   5. drush_bootstrap() includes\bootstrap.inc:308
    2.4231    6308752   6. _drush_bootstrap_drupal_full() includes\bootstrap.inc:185
    2.4231    6325600   7. drupal_bootstrap() includes\bootstrap.inc:928
    2.4801   10027992   8. _drupal_bootstrap_full() includes\bootstrap.inc:2278
    4.9603   27230744   9. module_invoke_all() includes\common.inc:5193
    5.0323   28675464  10. call_user_func_array() includes\module.inc:895
    5.0323   28675560  11. rules_init() includes\module.inc:895
    5.0323   28675624  12. rules_invoke_event() sites\all\modules\rules\rules.module:15
    5.0323   28675888  13. rules_get_cache() sites\all\modules\rules\rules.module:972
    5.0423   29728680  14. RulesEventSet::rebuildEventCache() sites\all\modules\rules\rules.module:336
    5.1843   33499352  15. RulesContainerPlugin->optimize() sites\all\modules\rules\includes\rules.plugins.inc:805
    5.1843   33499728  16. RulesReactionRule->optimize() sites\all\modules\rules\includes\rules.core.inc:2398
    5.1843   33499728  17. RulesContainerPlugin->optimize() sites\all\modules\rules\includes\rules.plugins.inc:515
    5.1843   33500152  18. RulesContainerPlugin->optimize() sites\all\modules\rules\includes\rules.core.inc:2398
    5.1843   33500528  19. RulesPlugin->optimize() sites\all\modules\rules\includes\rules.core.inc:2398
    5.1843   33500560  20. RulesAbstractPlugin->processSettings() sites\all\modules\rules\includes\rules.core.inc:1185
    5.1843   33500768  21. RulesCondition->process() sites\all\modules\rules\includes\rules.core.inc:1563
    5.1843   33500880  22. RulesExtendable->__call() sites\all\modules\rules\includes\rules.core.inc:1563
    5.1843   33500880  23. RulesAbstractPlugin->forceSetUp() sites\all\modules\rules\includes\rules.core.inc:361
    5.1843   33500960  24. RulesAbstractPlugin->setUp() sites\all\modules\rules\includes\rules.core.inc:1511
    5.1843   33504592  25. RulesExtendable->__call() sites\all\modules\rules\includes\rules.core.inc:1499
    5.1843   33504616  26. FacesExtendable->__call() sites\all\modules\rules\includes\rules.core.inc:362
    5.1853   33505216  27. call_user_func_array() sites\all\modules\rules\includes\faces.inc:123
    5.1853   33505504  28. rules_condition_data_is_info_alter() sites\all\modules\rules\includes\faces.inc:123
    5.1853   33505912  29. RulesPlugin->applyDataSelector() sites\all\modules\rules\modules\data.eval.inc:346
    5.1853   33507856  30. rules_wrap_data() sites\all\modules\rules\includes\rules.core.inc:1020
    5.1853   33508848  31. entity_metadata_wrapper() sites\all\modules\rules\rules.module:486
    5.1853   33511136  32. EntityDrupalWrapper->__construct() sites\all\modules\entity\entity.module:1410
    5.1853   33511792  33. EntityDrupalWrapper->setUp() sites\all\modules\entity\includes\entity.wrapper.inc:584
    5.1853   33511880  34. entity_get_property_info() sites\all\modules\entity\includes\entity.wrapper.inc:588
    5.2483   35005024  35. drupal_alter() sites\all\modules\entity\includes\entity.property.inc:39
    5.2643   35011488  36. profile2_entity_property_info_alter() includes\module.inc:1101
    5.2643   35011528  37. profile2_get_types() sites\all\modules\profile2\profile2.info.inc:72
    5.2643   35011664  38. entity_load_multiple_by_name() sites\all\modules\profile2\profile2.module:152
    5.2643   35011744  39. entity_load() sites\all\modules\entity\entity.module:255
    5.2643   35011776  40. entity_get_controller() includes\common.inc:7849

In my stack, Profile2 was being triggered.

Tried "drush dis profile2", but this threw the same error.
Tried disabling via the db in system table, but that same error stack was being throw
Success with registry_rebuild module (http://www.example.com/sites/all/modules/registry_rebuild/registry_rebui...)

RavindraSingh’s picture

Status: Active » Closed (cannot reproduce)

I have tried to replicate this issue with Drupal 7.32 and rules 7.x-2.8. can't reproduce. please upgrade your core and modules. or add specific steps to replicate.