I've the following error when running: drush status

Fatal error: Unsupported operand types in rules.module on line 227

Call Stack:
  1. {main}() /usr/share/drush/drush.php:0
  2. drush_main() /usr/share/drush/drush.php:40
  3. drush_dispatch($command = array ('description' => 'Provides a birds-eye view of the current Drupal installation, if any.', 'bootstrap' => 0, 'aliases' => array (0 => 'status', 1 => 'st'), 'examples' => array ('drush status version' => 'Show all status lines that contain version information.', 'drush status --pipe' => 'A list key=value items separated by line breaks.', 'drush status drush-version --pipe' => 'Emit just the drush version with no label.'), 'arguments' => array (), 'options' => array ('show-passwords' => 'Show database password.'), 'command' => 'core-status', 'command-hook' => 'core-status', 'commandfile' => 'core', 'path' => '/usr/share/drush/commands/core', 'engines' => array (), 'callback' => 'drush_command', 'deprecated-aliases' => array (0 => 'core status'), 'extras' => array (), 'core' => array (), 'scope' => 'site', 'drupal dependencies' => array (), 'drush dependencies' => array (), 'bootstrap_errors' => array (), 'hidden' => FALSE, 'is_alias' => TRUE)) /usr/share/drush/drush.php:90
  4. call_user_func_array('drush_command', array ()) /usr/share/drush/includes/drush.inc:51
  5. drush_command() /usr/share/drush/includes/drush.inc:0
  6. call_user_func_array('drush_invoke', array (0 => 'core-status')) /usr/share/drush/includes/command.inc:381
  7. drush_invoke($command = 'core-status') /usr/share/drush/includes/command.inc:0
  8. call_user_func_array('drush_core_status', array ()) /usr/share/drush/includes/command.inc:330
  9. drush_core_status() /usr/share/drush/includes/command.inc:0
 10. drush_bootstrap_max() /usr/share/drush/commands/core/core.drush.inc:562
 11. drush_bootstrap($phase = 5) /usr/share/drush/includes/environment.inc:252
 12. _drush_bootstrap_drupal_full() /usr/share/drush/includes/environment.inc:172
 13. drupal_bootstrap($phase = 7, $new_phase = ???) /usr/share/drush/includes/environment.inc:750
 14. _drupal_bootstrap_full() /var/www/drupal7/includes/bootstrap.inc:2259
 15. module_invoke_all($hook = 'init') /var/www/drupal7/includes/common.inc:5145
 16. call_user_func_array('rules_init', array ()) /var/www/drupal7/includes/module.inc:895
 17. rules_init() /var/www/drupal7/includes/module.inc:0
 18. rules_invoke_event('init') /var/www/drupal7/sites/all/modules/contrib/rules/rules.module:12
 19. rules_get_cache($cid = 'event_init') /var/www/drupal7/sites/all/modules/contrib/rules/rules.module:969
 20. RulesEventSet::rebuildEventCache() /var/www/drupal7/sites/all/modules/contrib/rules/rules.module:333
 21. rules_fetch_data($hook = 'event_info') /var/www/drupal7/sites/all/modules/contrib/rules/includes/rules.plugins.inc:761
 22. _drupal_error_handler($error_level = 8, $message = 'Undefined index: event_info', $filename = '/var/www/drupal7/sites/all/modules/contrib/rules/rules.module', $line = 227, $context = array ('hook' => 'event_info', 'data' => array ('event_info' => 0), 'discover' => array ('action_info' => 'RulesActionHandlerInterface', 'condition_info' => 'RulesConditionHandlerInterface', 'event_info' => 'RulesEventHandlerInterface'))) /var/www/drupal7/includes/bootstrap.inc:0
 23. _drupal_error_handler_real($error_level = 8, $message = 'Undefined index: event_info', $filename = '/var/www/drupal7/sites/all/modules/contrib/rules/rules.module', $line = 227, $context = array ('hook' => 'event_info', 'data' => array ('event_info' => 0), 'discover' => array ('action_info' => 'RulesActionHandlerInterface', 'condition_info' => 'RulesConditionHandlerInterface', 'event_info' => 'RulesEventHandlerInterface'))) /var/www/drupal7/includes/bootstrap.inc:2312
 24. _drupal_log_error($error = array ('%type' => 'Notice', '!message' => 'Undefined index: event_info', '%function' => 'rules_fetch_data()', '%file' => '/var/www/drupal7/sites/all/modules/contrib/rules/rules.module', '%line' => 227, 'severity_level' => 5), $fatal = FALSE) /var/www/drupal7/includes/errors.inc:75
 25. watchdog($type = 'php', $message = '%type: !message in %function (line %line of %file).', $variables = array ('%type' => 'Notice', '!message' => 'Undefined index: event_info', '%function' => 'rules_fetch_data()', '%file' => '/var/www/drupal7/sites/all/modules/contrib/rules/rules.module', '%line' => 227, 'severity_level' => 5), $severity = 5, $link = ???) /var/www/drupal7/includes/errors.inc:202
 26. module_invoke($module = 'rules', $hook = 'watchdog', array ('type' => 'php', 'message' => '%type: !message in %function (line %line of %file).', 'variables' => array ('%type' => 'Notice', '!message' => 'Undefined index: event_info', '%function' => 'rules_fetch_data()', '%file' => '/var/www/drupal7/sites/all/modules/contrib/rules/rules.module', '%line' => 227, 'severity_level' => 5), 'severity' => 5, 'link' => NULL, 'user' => class stdClass { public $uid = 0; public $hostname = '127.0.0.1'; public $roles = array (...); public $cache = 0 }, 'uid' => 0, 'request_uri' => 'http://default/index.php', 'referer' => '', 'ip' => '127.0.0.1', 'timestamp' => 1387812555)) /var/www/drupal7/includes/bootstrap.inc:1734
 27. call_user_func_array('rules_watchdog', array (2 => array ('type' => 'php', 'message' => '%type: !message in %function (line %line of %file).', 'variables' => array (...), 'severity' => 5, 'link' => NULL, 'user' => class stdClass { ... }, 'uid' => 0, 'request_uri' => 'http://default/index.php', 'referer' => '', 'ip' => '127.0.0.1', 'timestamp' => 1387812555))) /var/www/drupal7/includes/module.inc:866
 28. rules_watchdog($log_entry = array ('type' => 'php', 'message' => '%type: !message in %function (line %line of %file).', 'variables' => array ('%type' => 'Notice', '!message' => 'Undefined index: event_info', '%function' => 'rules_fetch_data()', '%file' => '/var/www/drupal7/sites/all/modules/contrib/rules/rules.module', '%line' => 227, 'severity_level' => 5), 'severity' => 5, 'link' => NULL, 'user' => class stdClass { public $uid = 0; public $hostname = '127.0.0.1'; public $roles = array (...); public $cache = 0 }, 'uid' => 0, 'request_uri' => 'http://default/index.php', 'referer' => '', 'ip' => '127.0.0.1', 'timestamp' => 1387812555)) /var/www/drupal7/includes/module.inc:0
 29. rules_invoke_event('watchdog', array ('type' => 'php', 'message' => '%type: !message in %function (line %line of %file).', 'variables' => array ('%type' => 'Notice', '!message' => 'Undefined index: event_info', '%function' => 'rules_fetch_data()', '%file' => '/var/www/drupal7/sites/all/modules/contrib/rules/rules.module', '%line' => 227, 'severity_level' => 5), 'severity' => 5, 'link' => NULL, 'user' => class stdClass { public $uid = 0; public $hostname = '127.0.0.1'; public $roles = array (...); public $cache = 0 }, 'uid' => 0, 'request_uri' => 'http://default/index.php', 'referer' => '', 'ip' => '127.0.0.1', 'timestamp' => 1387812555)) /var/www/drupal7/sites/all/modules/contrib/rules/modules/events.inc:180
 30. rules_get_cache($cid = 'event_watchdog') /var/www/drupal7/sites/all/modules/contrib/rules/rules.module:969
 31. RulesEventSet::rebuildEventCache() /var/www/drupal7/sites/all/modules/contrib/rules/rules.module:333
 32. rules_fetch_data($hook = 'event_info') /var/www/drupal7/sites/all/modules/contrib/rules/includes/rules.plugins.inc:761


Variables in local scope (#32):
  $data = array ('event_info' => 0)
  $discover = array ('action_info' => 'RulesActionHandlerInterface', 'condition_info' => 'RulesConditionHandlerInterface', 'event_info' => 'RulesEventHandlerInterface')
  $hook = 'event_info'
  $item = *uninitialized*
  $module = *uninitialized*
  $name = *uninitialized*
  $result = *uninitialized*

I'm using memcached as my cache engine.
Any suggestion what it could be causing it?

Comments

kristen pol’s picture

I'm seeing the same error. Code is:

return $export + parent::exportChildren();

I'm surprised more people haven't chimed in with the same issue. Not sure what the fix is.

[UPDATE] Actually... mine was in rules.plugins.inc. I updated to the latest dev and cleared the cache a bunch of times and it is gone. I think it was just the cache clearing that fixed it but perhaps try the latest dev.

mschudders’s picture

StatusFileSize
new606 bytes

Patch attached.

Not yet throurougly checked, but it removes the error so.

joelpittet’s picture

I had the same error on -dev then went back to 2.6 and same thing. Deleted rules, cleared cache download -dev again and it's back to working, kinda similar to #1. After that the error didn't happen again even after drush dis rules -y and drush pmu rules -y and drush en rules -y again.

Here's the callstack if that helps:

Fatal error: Unsupported operand types in /sites/all/modules/contrib/rules/rules.module on line 227

Call Stack:
    0.0005     263784   1. {main}() ~/drush/drush.php:0
    0.0263    2511288   2. drush_main() ~/drush/drush.php:16
    0.2173    7878208   3. _drush_bootstrap_and_dispatch() ~/drush/drush.php:61
    0.3559    7883392   4. drush_bootstrap_to_phase() ~/drush/drush.php:87
    0.3559    7883464   5. drush_bootstrap_max() ~/drush/includes/bootstrap.inc:291
    0.3952   10007904   6. drush_bootstrap() ~/drush/includes/bootstrap.inc:345
    0.3978   10009192   7. _drush_bootstrap_drupal_full() ~/drush/includes/bootstrap.inc:185
    0.3978   10026344   8. drupal_bootstrap() ~/drush/includes/bootstrap.inc:938
    0.4334   13621520   9. _drupal_bootstrap_full() /includes/bootstrap.inc:2260
    0.7378   39797704  10. module_invoke_all() /includes/common.inc:5158
    0.7469   39926248  11. call_user_func_array() /includes/module.inc:895
    0.7469   39926448  12. rules_init() /includes/module.inc:895
    0.7475   39965376  13. rules_invoke_event() /sites/all/modules/contrib/rules/rules.module:12
    0.7476   39965832  14. rules_get_cache() /sites/all/modules/contrib/rules/rules.module:969
    0.7602   41675776  15. RulesEventSet::rebuildEventCache() /sites/all/modules/contrib/rules/rules.module:333
    0.7602   41675920  16. rules_fetch_data() /sites/all/modules/contrib/rules/includes/rules.plugins.inc:761
kenorb’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: rules_fix_unsupported_operand_types_227.patch, failed testing.

HeathN’s picture

Tried 7.x-2.5, 7.x-2.6 and 7.x-2.x-dev all failed with this error:

-bash-$ drush cc all
PHP Fatal error:  Unsupported operand types in drupal/sites/all/modules/contrib/rules/rules.module on line 227
Drush command terminated abnormally due to an unrecoverable error.                                                                                                    [error]
Error: Unsupported operand types in drupal/sites/all/modules/contrib/rules/rules.module, line 227

Really need rules to be working. Is there anything I can do to get more helpful errors for you?

Edit: This is a fatal error, should we up the priority of this to major?

kenorb’s picture

@HeathN: apply the patch, and re-attach to pass the tests

13rac1’s picture

I applied this patch, but now I am getting

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

Fun Fun.

13rac1’s picture

The code in question is:

/**
 * Get the entity controller class for an entity type.
 */
function entity_get_controller($entity_type) {
  $controllers = &drupal_static(__FUNCTION__, array());
  if (!isset($controllers[$entity_type])) {
    $type_info = entity_get_info($entity_type);
    $class = $type_info['controller class'];
    $controllers[$entity_type] = new $class($entity_type); // #7837
  }
  return $controllers[$entity_type];
}

The value of $entity_type when the error occurs is: rules_config

An potentialy useful note: This only occurs on my local copy of the website. It works fine on dev, staging, and live.

13rac1’s picture

I don't have a solution yet, but rebuilding the registry is a workaround: https://drupal.org/project/registry_rebuild

drush dl registry_rebuild
drush rr
sobi3ch’s picture

#10 works for me! But I need download registry_rebuild manually.
Follow this blog to do it.

suntower’s picture

I am having the same issue. I am converting a D6 site to D7.26.

I started with a clean D7.26 core, ran the updater to get the D7 db, then started adding D7 modules. After I added Rules, I got a WSOD and the error in Rules @ line 227.

I applied the patch from #2 which made no apparent difference. I tried the solution #10 and again no difference. I've had to disable Rules in order to move forward, but at some point, I'm gonna need it back.

Any suggestions?

jaskho’s picture

Neither the patch in #2 nor rebuilding the registry worked for me. However, the issue stopped occurring after I increased php memory limit (from 64M to 128M in my case). I haven't tried to debug the root cause (or even to confirm that memory is the actual problem), but I have been able to reproduce and then resolve the problem by adjusting memory_limit up/down. Worth a shot...

dremy’s picture

I was having this same problem and this worked for me from Stack Exchange:

  • Try going to http://yoursite.com/update.php and execute the form submit.
  • If this does not work, you must:
  • disable rules by SQL command:
  • UPDATE system SET status = 0 WHERE system.name = 'rules';
  • Execute drush cc all
  • Active drush again:
  • Drush en rules -y
maikeru’s picture

The patch in #2 wasn't applying clean in our drush make process - find attached one that does.

kenorb’s picture

Status: Needs work » Needs review
alauddin’s picture

#15 patch works.

thanks

khumbu’s picture

yes...it works...thx :)

kholloway’s picture

I had this issue on my local instance only after cloning a Dev database to my local.

The following solution worked for me:
Manually clear all sql cache tables (cache and all the cache_* tables)

Note:
You have to do it manually to your sql database as drush commands will keep throwing errors when they try to bootstrap the site. You may be able to do direct drush sql command line commands to truncate the tables as well but I didn't try that.

My local is working just fine now after doing that :)

alfthecat’s picture

Applied the patch after this issue killed a website completely.
It didn't solve my problem, patch applied but I got another error and the site still WSOD'd.

patch -p1 < rules-fix-unsupported-operand-types-2161847-2.patch
patching file rules.module
Hunk #1 succeeded at 230 (offset 7 lines).
drush cc all
PHP Fatal error:  Call to undefined function entity_load_multiple_by_name() in /var/aegir/platforms/xxxx/sites/all/modules/rules/rules.module on line 828
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: Call to undefined function entity_load_multiple_by_name() in
/var/aegir/platforms/xxx/sites/all/modules/rules/rules.module,
line 828

I tried manually truncating all my cache_ tables and the cache table itself (#2324587: Rules might be triggered too early in the bootstrap. To no avail.

Had to restore a backup.

geek-merlin’s picture

Ups, just seen that i created a dup over there at #2344579: WSOD: PHP Fatal error: Unsupported operand types in rules.module on line 234.
I think my patch there makes more sense.

I'm also facing the followup issue in #20.
Which more people experienced but no solution there: #2324587: Rules might be triggered too early in the bootstrap

geek-merlin’s picture

Version: 7.x-2.6 » 7.x-2.x-dev
Priority: Normal » Critical

I'm not really sure, but my gut feeling is that this issue is essentially the same as #2324587: Rules might be triggered too early in the bootstrap.
As over there here too the backtraces indicate that rules does an event cache rebuild too early in the bootstrap process, which leads to whitescreens that are hard to reproduce. So setting critical too, and we might want to close the other issue.

geek-merlin’s picture

Here's how to reproduce the bug:
drush vset language_default notaserializedlanguageobject
That hit me and threw gazillions of notices in early bootstrap so surely triggering this bug.

interdruper’s picture

Status: Needs review » Reviewed & tested by the community

Patch #22 solved the issue for me. Now the module can be enabled/disabled without drush errors.

alfthecat’s picture

Status: Reviewed & tested by the community » Needs review

I think it's too soon to mark this as reviewed and tested as we still have the # 20 issue (for some - on multilingual? - scenarios).

geek-merlin’s picture

Status: Needs review » Reviewed & tested by the community

I think we should
* get the patch in - it fixes a coding bug and can be proven it can't harm
* attract fagos attention by setting this rtbc
* decide what to do with the underlying issue - imho "rules is not safe for early bootstrap events"

alfthecat’s picture

This is getting really bad. Simply enabling the css_injector module wsod's a site. After the patch from #22 the site still remains dead and produces the error as described in #2324587: Rules might be triggered too early in the bootstrap.

I've been trying latest dev releases of entity api and rules. Deleting cache tables, it all doesn't help. The only option seems to be to restore a backup and uninstall rules as it's a hazard atm.

  • fago committed f1565c1 on 7.x-2.x authored by axel.rutz
    Issue #2161847 by axel.rutz, maikeru, Mschudders | kenorb: Fixed Fatal...
fago’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, I committed the fix from #22. Let's collaborate in #2324587: Rules might be triggered too early in the bootstrap on how to make things less error-prone.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Anselm’s picture